Add note that give-item effect runs repeatedly

robot256
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Add note that give-item effect runs repeatedly

Post by robot256 »

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
curiosity
Filter Inserter
Filter Inserter
Posts: 656
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Add note that give-item effect runs repeatedly

Post by curiosity »

Per that thread, it sounds like the give-item effect was a mistake. Maybe the docs should advise against using it at all.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3937
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Add note that give-item effect runs repeatedly

Post by boskid »

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.
curiosity
Filter Inserter
Filter Inserter
Posts: 656
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Add note that give-item effect runs repeatedly

Post by curiosity »

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.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3937
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Add note that give-item effect runs repeatedly

Post by boskid »

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).
curiosity
Filter Inserter
Filter Inserter
Posts: 656
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Add note that give-item effect runs repeatedly

Post by curiosity »

Meaning it makes all the more sense for the docs to warn against the problematic cases.
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 324
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Add note that give-item effect runs repeatedly

Post by Therenas »

I noted the problematic case for the next release, thanks.
Post Reply

Return to “Resolved Requests”