Per this thread, every technology with the give-item effect are expected to give a new copy of the item every time any mod changes any technology.
124574
This behavior should be mentioned in the description of GiveItemModifier so that modders can account for this when giving items that have a high value or cannot be easily voided.
https://lua-api.factorio.com/latest/typ ... ifier.html
Add note that give-item effect runs repeatedly
Re: Add note that give-item effect runs repeatedly
Per that thread, it sounds like the give-item effect was a mistake. Maybe the docs should advise against using it at all.
Re: Add note that give-item effect runs repeatedly
give-item effect is still useful when mod or scenario uses Market entity since an offer that gives item is quite reasonable use case. Modifiers however are a common piece between markets and technologies and when give-item is used by a technology, the resolution falls back to giving item to players of that force, and may fail if a force somehow has no players at that moment.
Re: Add note that give-item effect runs repeatedly
The prototype stage Modifier type is separate from the runtime TechnologyModifier concept. And markets can only be configured during runtime while technologies can only be configured on startup. They are two completely non-intersecting topics from a mod maker's perspective.
Although, what happens to non-give-item market purchases when technology effects are reset? Are they just voided? If so, it's something worth mentioning somewhere.
Although, what happens to non-give-item market purchases when technology effects are reset? Are they just voided? If so, it's something worth mentioning somewhere.
Re: Add note that give-item effect runs repeatedly
Well, from the implementation point of view they are the same system, TechnologyPrototype effects holds Modifier and Market's offer holds Modifier. When technology is researched, modifiers are applied. When market price offer is purchased, modifier is applied. Modifiers is a common system spanning over both of those and it is possible that some modifiers make sense only as technology effect (unlocking recipe, since a force reset or mod changes will reevaluate unlocks, when used as market offer, the unlocks will be lost) while some make sense only as market offer (giving items is reasonable, with technologies is risky because may give items multiple times).
Re: Add note that give-item effect runs repeatedly
Meaning it makes all the more sense for the docs to warn against the problematic cases.
Re: Add note that give-item effect runs repeatedly
I noted the problematic case for the next release, thanks.