Fixed Existing Lua Check Errors

This commit is contained in:
Cooldude2606
2020-05-26 18:21:10 +01:00
parent 2aaeb06be3
commit 32507492b8
76 changed files with 1622 additions and 1617 deletions

View File

@@ -18,7 +18,7 @@ local Public = {
Global.register({
compilatrons = Public.compilatrons,
current_messages = Public.current_messages
},function(tbl)
}, function(tbl)
Public.compilatrons = tbl.compilatrons
Public.current_messages = tbl.current_messages
end)
@@ -42,7 +42,7 @@ local callback =
local function circle_messages()
for name, ent in pairs(Public.compilatrons) do
if not ent.valid then
Public.spawn_compilatron(game.players[1].surface,name)
Public.spawn_compilatron(game.players[1].surface, name)
end
local current_message = Public.current_messages[name]
local msg_number
@@ -66,7 +66,7 @@ Event.on_nth_tick(config.message_cycle, circle_messages)
--- This will add a compilatron to the global and start his message cycle
-- @tparam LuaEntity entity the compilatron entity that moves around
-- @tparam string name the name of the location that the complitron is at
-- @tparam string name the name of the location that the compilatron is at
function Public.add_compilatron(entity, name)
if not entity and not entity.valid then
return
@@ -85,19 +85,19 @@ end
--- This spawns a new compilatron on a surface with the given location tag (not a position)
-- @tparam LuaSurface surface the surface to spawn the compilatron on
-- @tparam string location the location tag that is in the config file
function Public.spawn_compilatron(surface,location)
function Public.spawn_compilatron(surface, location)
local position = locations[location]
local pos = surface.find_non_colliding_position('compilatron', position, 1.5, 0.5)
local compi = surface.create_entity {name='compilatron',position=pos,force=game.forces.neutral}
Public.add_compilatron(compi,location)
local compi = surface.create_entity {name='compilatron', position=pos, force=game.forces.neutral}
Public.add_compilatron(compi, location)
end
-- When the first player is created this will create all compilatrons that are resisted in the config
Event.add(defines.events.on_player_created,function(event)
Event.add(defines.events.on_player_created, function(event)
if event.player_index ~= 1 then return end
local player = Game.get_player_by_index(event.player_index)
for location,pos in pairs(locations) do
Public.spawn_compilatron(player.surface,location)
for location in pairs(locations) do
Public.spawn_compilatron(player.surface, location)
end
end)