Simple property requests (something that exists but has no way to read/write it)

VortiK
Burner Inserter
Burner Inserter
Posts: 9
Joined: Wed Jan 17, 2018 8:22 pm

Re: Simple property requests (something that exists but has no way to read/write it)

Post by VortiK » Tue Jan 30, 2018 12:02 am

Thanks for your reply, I've made a poc mod to show the issue and bug reported it : viewtopic.php?f=7&t=57301

Pandemoneus
Fast Inserter
Fast Inserter
Posts: 127
Joined: Fri May 08, 2015 2:25 pm

Re: Simple property requests (something that exists but has no way to read/write it)

Post by Pandemoneus » Tue Jan 30, 2018 12:45 am

I'd like to request a read for the total amount of resources in a resource patch (either % yield for infinite or exact amount for finite resources) like it shows in the map when you hover over a patch. I know modders can implement a search for connected resource entites to calculate that amount. I did that, but honestly, it's not that fast, and since the game already shows the amount, could it be accessable please?

Together with or instead of that, it would also be nice if you could get all the resource entites of the resource patch.
My RSO+Bob's+Angel's modpack: Farlands (outdated)
Mods (current): Resource Labels
Mods (old): Biter Spires

adamius
Burner Inserter
Burner Inserter
Posts: 12
Joined: Mon Mar 19, 2018 9:18 am

Re: Simple property requests (something that exists but has no way to read/write it)

Post by adamius » Sat Jun 02, 2018 8:57 pm

game.savename - name of save game .zip as passed to factorio on headless command line. as used by game.server_save() when name is not supplied. (I think)

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 2523
Joined: Tue Jul 12, 2016 9:03 am

Re: Simple property requests (something that exists but has no way to read/write it)

Post by eradicator » Sat Jun 02, 2018 9:32 pm

Pandemoneus wrote:I'd like to request a read for the total amount of resources in a resource patch (either % yield for infinite or exact amount for finite resources) like it shows in the map when you hover over a patch. I know modders can implement a search for connected resource entites to calculate that amount. I did that, but honestly, it's not that fast, and since the game already shows the amount, could it be accessable please?

Together with or instead of that, it would also be nice if you could get all the resource entites of the resource patch.
Those two ++2

Rseding91
Factorio Staff
Factorio Staff
Posts: 7946
Joined: Wed Jun 11, 2014 5:23 am

Re: Simple property requests (something that exists but has no way to read/write it)

Post by Rseding91 » Sat Jun 09, 2018 9:20 am

adamius wrote:game.savename - name of save game .zip as passed to factorio on headless command line. as used by game.server_save() when name is not supplied. (I think)
The save file name is not part of the game state and likely never will be meaning not even the game knows what the name was in mp.
If you want to get ahold of me I'm almost always on IRC and Discord.

adamius
Burner Inserter
Burner Inserter
Posts: 12
Joined: Mon Mar 19, 2018 9:18 am

Re: Simple property requests (something that exists but has no way to read/write it)

Post by adamius » Tue Jun 12, 2018 5:33 am

Rseding91 wrote:
adamius wrote:game.savename - name of save game .zip as passed to factorio on headless command line. as used by game.server_save() when name is not supplied. (I think)
The save file name is not part of the game state and likely never will be meaning not even the game knows what the name was in mp.
Does game.server_save() therefore cause a call to something outside, eg the execute core (for want of a better term), to perform the save because that core knows what the filename is when it was not provided?

For context, I’ve got code right now that benefits from having the save name and server date time. I’ve also been told neither of these are possible due to desync in the game engine. I’m fascinated by the actuality of having something actively working yet being told it is completely impossible.

Rseding91
Factorio Staff
Factorio Staff
Posts: 7946
Joined: Wed Jun 11, 2014 5:23 am

Re: Simple property requests (something that exists but has no way to read/write it)

Post by Rseding91 » Tue Jun 12, 2018 6:48 am

adamius wrote:
Rseding91 wrote:
adamius wrote:game.savename - name of save game .zip as passed to factorio on headless command line. as used by game.server_save() when name is not supplied. (I think)
The save file name is not part of the game state and likely never will be meaning not even the game knows what the name was in mp.
Does game.server_save() therefore cause a call to something outside, eg the execute core (for want of a better term), to perform the save because that core knows what the filename is when it was not provided?

For context, I’ve got code right now that benefits from having the save name and server date time. I’ve also been told neither of these are possible due to desync in the game engine. I’m fascinated by the actuality of having something actively working yet being told it is completely impossible.
The server knows what the name of the save was it loaded and knows where the temporary save directory is and what it would name the next autosave. That information is not stored *in* the save file and is not communicated anywhere with joining players. It exists in memory on the server (and in memory on the client when playing single player) but outside that isn't not available for mods to read.
If you want to get ahold of me I'm almost always on IRC and Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 2523
Joined: Tue Jul 12, 2016 9:03 am

Re: Simple property requests (something that exists but has no way to read/write it)

Post by eradicator » Wed Jul 11, 2018 7:34 pm

Runtime API access to:

LuaEntityPrototype.belt_distance
LuaEntityPrototype.container_distance
LuaEntityPrototype.belt_length


to faciliate automated script based loader placement.

Kovus
Inserter
Inserter
Posts: 20
Joined: Sat Feb 27, 2016 5:25 pm

Re: Simple property requests (something that exists but has no way to read/write it)

Post by Kovus » Tue Jul 17, 2018 9:34 pm

I'd like to have runtime read access to ammo item prototype's target damage values. I'm not sure if it would need to expose a large section of data, but it would be of interest to be able to get or calculate the damage that a particular ammo would do.

I'm guessing that LuaItemPrototype::action/action_delivery/(source?) target_effects would have to be exposed in some fashion.


Edit:
Appears that this information is already exposed through partially documented methods: LuaItemPrototype.get_ammo_type().action, etc.

Avacado
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Fri Jul 22, 2016 3:17 pm

Re: Simple property requests (something that exists but has no way to read/write it)

Post by Avacado » Fri Jul 20, 2018 4:52 pm

Runtime API read access to:

LuaRecipePrototype.main_product

to help identify what image a recipe is using during runtime. Thanks!

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 1675
Joined: Sat Jun 11, 2016 6:41 am

Re: Simple property requests (something that exists but has no way to read/write it)

Post by Optera » Sat Jul 28, 2018 7:28 am

A shortcut get_item_contents() to fetch a list of all equipment's item names similar to how get_contents() fetches all equipment names.

Currently getting all item names for equipment in a grid is rather slow when all you're interested is how many of x there are in the grid.

Code: Select all

local item_contents = {}
for _, equipment in pairs(grid_equipment) do  
  local item_name = equipment.prototype.take_result.name
  if item_contents[item_name] then
    item_contents[item_name] = item_contents[item_name] + 1
  else
    item_contents[item_name] = 1
  end
end
My Mods:

User avatar
Reika
Filter Inserter
Filter Inserter
Posts: 332
Joined: Tue May 19, 2015 1:56 am

Re: Simple property requests (something that exists but has no way to read/write it)

Post by Reika » Thu Aug 30, 2018 8:59 am

Some way to quickly and easily fetch "damage per shot" of a turret, based on its current ammo type, its owner force tech bonuses, et cetera.

Basically the data used for this info panel:
Image

Boodals
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Feb 11, 2018 7:10 pm

Re: Simple property requests (something that exists but has no way to read/write it)

Post by Boodals » Wed Sep 12, 2018 7:06 pm

Can we get LuaEntity.beam_source and LuaEntity.beam_target for beam entities? Preferably read/write, but just read would be fine if moving beams is too complex. Should support positions and entities, and maybe a way to tell whether it is an entity or a position.

CaveGrinder
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Aug 24, 2018 7:42 pm

Re: Simple property requests (something that exists but has no way to read/write it)

Post by CaveGrinder » Fri Sep 14, 2018 10:45 am

would be great to get
LuaEntityPrototype:automated_ammo_count (based on the already existing value in the turret data prototype automated_ammo_count)

Post Reply

Return to “Implemented mod requests”