Page 1 of 1

Documentation about global.attack_data ?

Posted: Sun Jun 12, 2016 5:23 am
by CyberPhantom
In the freeplay scenario's control.lua (in v0.12.35), I see code that sets the global.attack_data table like so:

Code: Select all

init_attack_data = function()
  global.attack_data = {
    -- whether all attacks are enabled
    enabled = true,
    -- this script is allowed to change the attack values attack_count and until_next_attack
    change_values = true,
    -- what distracts the creepers during the attack
    distraction = defines.distraction.byenemy,
    -- number of units in the next attack
    attack_count = 5,
    -- time to the next attack
    until_next_attack = 60 * 60 * 60,
  }
end
Is this attack_data table used by the game engine somehow? E.g., does changing global.attack_data["attack_count"] change the number of aliens sent in the next attack? I don't see any reference to this in the wiki. Where can I find out more about how it works?

Re: Documentation about global.attack_data ?

Posted: Sun Jun 12, 2016 5:30 am
by DaveMcW
Each mod gets its own global table. You can't access the global table from another mod.

Re: Documentation about global.attack_data ?

Posted: Sun Jun 12, 2016 5:42 am
by CyberPhantom
I guess what's confusing me is that I see the freeplay scenario setting the value for global.attack_data, but I do not see it being used in any meaningful way.

For example, it sets global.attack_data["change_values"] to true, but no where else is "change_values" referenced. So what's the point?

Am I missing something?

Re: Documentation about global.attack_data ?

Posted: Sun Jun 12, 2016 7:03 am
by DaveMcW
Looks like those values were used by the old Rocket Defense in 0.11. It does nothing now.

Re: Documentation about global.attack_data ?

Posted: Sun Jun 12, 2016 6:17 pm
by CyberPhantom
Ah, that makes sense. Thank you! :)