Page 1 of 1
Tech effect bonus "constant" icons overlaid on ... what? how?
Posted: Thu Nov 26, 2020 12:50 pm
by Deadlock989
1.1.0 introduced new tech bonus effect icons ("constants") and utility functions to overlay them on tech icons, which is great (I was doing similar in 0.17 but these resources are superior).
The majority of stuff is defined in utility-sprites.lua. However some tech effect bonus icons appear to derive their base layer from an entity icon. Ones I've spotted so far are lab speed research
and follower count bonuses. In a modded situation you end up with things like this:

- Untitled.jpg (100.8 KiB) Viewed 1069 times
That bonus icon is based on a low-level lab icon that vanilla doesn't know about. So clearly it is automatically deriving these icons based on known prototypes, but I can't locate where this is being done (utility-sprites.lua only seems to specify some temporary sprite for them in a function called make_default_modifier_icon).
My question is: how is the entity icon selected? First found? Based on their order property?
Re: Tech "constant" icons overlaid on ... what? how?
Posted: Thu Nov 26, 2020 12:59 pm
by posila
Deadlock989 wrote: Thu Nov 26, 2020 12:50 pmMy question is: how is the entity icon selected? First found? Based on their order property?
Correct. It is first found and which one is found first is determined by order property.
Inside technology effect definition, you can use "infer_icon = false" to disable this behavior for this one technology effect. In which case utility-sprites.laboratory_speed_modifier_icon would be used instead. Or you can specify icon(s) explicitly inside the technology effect definition.
There is also "use_icon_overlay_constant = false" to suppress drawing of the "constant" over the effect icon.
Re: Tech "constant" icons overlaid on ... what? how?
Posted: Thu Nov 26, 2020 1:12 pm
by Deadlock989
Nice options to have, thanks.
Follow-up for anyone searching for this later ... turns out that the follower robot count icon isn't dynamic (as of 1.1.1), it is manually getting the robot using make_technology_modifier_icon("defender.png"), so infer_icon etc. doesn't work on those, you have to override it with something else.
Re: Tech "constant" icons overlaid on ... what? how?
Posted: Thu Nov 26, 2020 1:42 pm
by posila
I'm gonna put default for all effects here:
Code: Select all
Default: infer_icon = false, use_icon_overlay_constant = true:
CharacterMiningSpeed:
CharacterInventorySlotsBonus:
CharacterLogisticTrashSlots:
ArtilleryRange:
MaximumFollowingRobotsCount:
GhostTimeToLive:
MiningDrillProductivityBonus:
CharacterCraftingSpeed:
CharacterRunningSpeed:
CharacterBuildDistance:
CharacterItemDropDistance:
CharacterReachDistance:
CharacterResourceReachDistance:
CharacterItemPickupDistance:
CharacterLootPickupDistance:
CharacterHealthBonus:
ZoomToWorldGhostBuildingEnabled:
ZoomToWorldBlueprintEnabled:
ZoomToWorldDeconstructionPlannerEnabled:
ZoomToWorldUpgradePlannerEnabled:
ZoomToWorldSelectionToolEnabled:
DeconstructionTimeToLive:
MaxFailedAttemptsPerTickPerConstructionQueue:
MaxSuccessfulAttempsPerTickPerConstructionQueue:
InserterStackSizeBonus:
StackInserterCapacityBonus:
Default: infer_icon = true, use_icon_overlay_constant = true:
LaboratorySpeed:
AmmoDamage:
TurretAttack:
GunSpeed:
FollowingRobotsLifetime:
TrainBrakingForceBonus:
WorkerRobotsSpeed:
WorkerRobotsStorage:
WorkerRobotsBattery:
LaboratoryProductivity:
Default: infer_icon = false, use_icon_overlay_constant = false:
UnlockRecipe:
GiveItem:
CharacterLogisticRequests:
ZoomToWorldEnabled:
Nothing:
CharacterAdditionalMiningCategories:
Also list of effects for which infer_icon = true does something
Code: Select all
InserterStackSizeBonus:
StackInserterCapacityBonus:
WorkerRobotsSpeed:
WorkerRobotsStorage:
WorkerRobotsBattery:
MiningDrillProductivityBonus:
TrainBrakingForceBonus:
LaboratorySpeed:
LaboratoryProductivity:
ArtilleryRange:
MaximumFollowingRobotsCount:
FollowingRobotsLifetime:
TurretAttack:
AmmoDamage:
GunSpeed: