Tech effect bonus "constant" icons overlaid on ... what? how?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Tech effect bonus "constant" icons overlaid on ... what? how?

Post 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
Untitled.jpg (100.8 KiB) Viewed 704 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?
Last edited by Deadlock989 on Thu Nov 26, 2020 6:54 pm, edited 2 times in total.
Image

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Tech "constant" icons overlaid on ... what? how?

Post by posila »

Deadlock989 wrote:
Thu Nov 26, 2020 12:50 pm
My 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.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Tech "constant" icons overlaid on ... what? how?

Post 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.
Image

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Tech "constant" icons overlaid on ... what? how?

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

Post Reply

Return to “Modding help”