Event: on_player_removed_equipment - actual energy value needed

Things that we aren't going to implement
DeznekCZ
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Sep 23, 2016 12:56 pm
Contact:

Event: on_player_removed_equipment - actual energy value needed

Post 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
Rseding91
Factorio Staff
Factorio Staff
Posts: 14343
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Event: on_player_removed_equipment - actual energy value needed

Post 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.
If you want to get ahold of me I'm almost always on Discord.
DeznekCZ
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Sep 23, 2016 12:56 pm
Contact:

Re: Event: on_player_removed_equipment - actual energy value needed

Post 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?
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Event: on_player_removed_equipment - actual energy value needed

Post 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?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
DeznekCZ
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Sep 23, 2016 12:56 pm
Contact:

Re: Event: on_player_removed_equipment - actual energy value needed

Post 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
Post Reply

Return to “Won't implement”