Code: Select all
data:extend( {
{
type = "unit-spawner",
name = "biter-spawner",
max_health = 700, -- double health
healing_per_tick = 0.04, -- double healing
spawning_cooldown = { {3600, 1500} }, -- 1/10 spawn rate
},
} )
Code: Select all
data:extend( {
{
type = "unit-spawner",
name = "biter-spawner",
max_health = 700, -- double health
healing_per_tick = 0.04, -- double healing
spawning_cooldown = { {3600, 1500} }, -- 1/10 spawn rate
},
} )
Actually... You use data:extend(table) to add new data. To modify data that exists in the base game (or another mod) you don't use extend but instead actually do so 'directly' via data.raw (which of course means that what you are modifying needs to be loaded before your mod using the dependencies in info.json, though it defaults to requiring base if you don't specify it at all in the info.json) ex:Taehl wrote:if I understand correctly, one cannot simply change such variables directly
Code: Select all
data.raw.type_of_what_you_are_modifying.name_of_what_you_are_modifying.property_of_what_you_are_modifying = new_value
Code: Select all
data.raw["unit-spawner"]["biter-spawner"] = new_table_with_ALL_info_including_things_you_did_not_change
Code: Select all
data.raw["unit-spawner"]["biter-spawner"].max_health = 700
data.raw["unit-spawner"]["biter-spawner"].healing_per_tick = 0.04
-- note you had a nested table for spawning_cooldown, that's not how it is in base!
data.raw["unit-spawner"]["biter-spawner"].spawning_cooldown = {3600, 1500}
Code: Select all
local spawner = data.raw["unit-spawner"]["biter-spawner"]
spawner.max_health = 700
spawner.healing_per_tick = 0.04
spawner.spawning_cooldown = {3600, 1500}
Sounds likeTaehl wrote:That sounds like it should control the amount of biters spawned, right?
So that data.isdemo can be checked (including non-demo defined enemies in the demo == error lol).Taehl wrote:why is "result_units" a function
Um... this one I have NO idea... it's changed from what I remember pre v11.Taehl wrote:why is "res[1]" a table with named indexes, but "res[2]" and "res[3]" only have numbered indexes?
Look at https://forums.factorio.com/forum/vie ... =25&t=7974 and maybe https://forums.factorio.com/forum/vie ... =14&t=7935Taehl wrote:I'm also going to play with "max_count_of_owned_units" and "max_friends_around_to_spawn". That sounds like it should control the amount of biters spawned, right?