Page 1 of 1
Event: on_player_removed_equipment - actual energy value needed
Posted: Sun Aug 30, 2020 11:18 pm
by DeznekCZ
Hi Developers,
for my mod i request to know how many energy was inside removed equipment items. Is there possible to add some optional arguments to get result.
Ideas:
- add event: on_player_pre_removed_equipment: equipment: LuaEquipment, grid: LuaEquipmentGrid, owner: LuaEntity
- add event value: energy: array of table { name: string, energy: int }
This API extension will be used for saving of magazine contents in:
https://mods.factorio.com/mod/GunEquipment
This API extension can be also used for other modes handling with bateries, may need also extension to add charged equipment items.
Thanks for reaction,
DeznekCZ
Re: Event: on_player_removed_equipment - actual energy value needed
Posted: Mon Aug 31, 2020 8:05 pm
by Rseding91
The entity that owns the equipment is unknown and may simply not exist. For example armor - it can be on the ground and you can still be editing it in the GUI. It's not owned by any entity it just exists.
As for the other values and the event - I don't see them happening. That's simply something outside of modding support.
Re: Event: on_player_removed_equipment - actual energy value needed
Posted: Mon Aug 31, 2020 8:40 pm
by DeznekCZ
You mean for example create a simple script call after fire (inside event of weapon), store actual value and in custom on remove reaction read that value?
Is there any identifier of grid?
Re: Event: on_player_removed_equipment - actual energy value needed
Posted: Mon Aug 31, 2020 9:42 pm
by eradicator
Rseding91 wrote: Mon Aug 31, 2020 8:05 pm
As for the other values and the event
It's already counting the number of equipments removed, would it be that difficult to return the
total energy contained in those? As it looks like only one type of equiment can be removed at once anyway i think just one number would be sufficient. Or is this about the performance impact of fetching the energy values?
Re: Event: on_player_removed_equipment - actual energy value needed
Posted: Mon Aug 31, 2020 11:09 pm
by DeznekCZ
eradicator wrote: Mon Aug 31, 2020 9:42 pm
Rseding91 wrote: Mon Aug 31, 2020 8:05 pm
As for the other values and the event
It's already counting the number of equipments removed, would it be that difficult to return the
total energy contained in those? As it looks like only one type of equiment can be removed at once anyway i think just one number would be sufficient. Or is this about the performance impact of fetching the energy values?
on_player_removed_equipment
Called after the player removes equipment from an equipment grid
Contains
player_index :: uint
grid :: LuaEquipmentGrid: The equipment grid removed from.
equipment :: string: The equipment removed.
count :: uint: The count of equipment removed.
If 'equipment' is name of equipment and not an item, then I need to know only total energy of all (or array of numbers for more precise).
That is a good idea