Documentation about global.attack_data ?

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
User avatar
CyberPhantom
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Jun 12, 2016 5:13 am
Contact:

Documentation about global.attack_data ?

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

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Documentation about global.attack_data ?

Post by DaveMcW »

Each mod gets its own global table. You can't access the global table from another mod.

User avatar
CyberPhantom
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Jun 12, 2016 5:13 am
Contact:

Re: Documentation about global.attack_data ?

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

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Documentation about global.attack_data ?

Post by DaveMcW »

Looks like those values were used by the old Rocket Defense in 0.11. It does nothing now.

User avatar
CyberPhantom
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Jun 12, 2016 5:13 am
Contact:

Re: Documentation about global.attack_data ?

Post by CyberPhantom »

Ah, that makes sense. Thank you! :)

Post Reply

Return to “Modding discussion”