1
0
mirror of https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git synced 2025-01-18 02:58:37 +02:00

Added catch for incorrect use of global vars. Thanks to Mylon!

This commit is contained in:
Oarcinae 2017-07-25 18:12:55 -04:00
parent cbbb9408fe
commit 46c0560d51
2 changed files with 19 additions and 4 deletions

View File

@ -131,8 +131,8 @@ NEAR_MIN_DIST = 25 --50
NEAR_MAX_DIST = 100 --125
--
-- Far Distance in chunks
FAR_MIN_DIST = 100 --50
FAR_MAX_DIST = 200 --125
FAR_MIN_DIST = 200 --50
FAR_MAX_DIST = 300 --125
---------------------------------------
-- Resource & Spawn Circle Options

View File

@ -13,8 +13,7 @@
--
-- Feel free to re-use anything you want. It would be nice to give me credit
-- if you can.
--
-- Follow server info on @_Oarc_
-- To keep the scenario more manageable I have done the following:
@ -121,6 +120,16 @@ script.on_init(function(event)
ConfigureAlienStartingParams()
SetServerWelcomeMessages()
--If any (not global.) globals are written to at this point, an error will be thrown.
--eg, x = 2 will throw an error because it's not global.x
setmetatable(_G, {
__newindex = function(_, n)
log("Attempt to write to undeclared var " .. n)
game.print("Attempt to write to undeclared var " .. n)
end
})
end)
@ -135,6 +144,12 @@ script.on_event(defines.events.on_rocket_launched, function(event)
end)
script.on_event(defines.events.on_console_chat, function(event)
DebugPrint(event.message)
end)
----------------------------------------
-- Chunk Generation
----------------------------------------