mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-03 14:53:01 +02:00
Implemented Cams, fixed invalid entity log spam
This commit is contained in:
parent
999d7c141f
commit
5168e77c01
@ -20,6 +20,7 @@ require "tasklist"
|
||||
require "autodeconstruct"
|
||||
require "corpse_util"
|
||||
require "reactor_meltdown"
|
||||
require "screenshot"
|
||||
local Event = require "utils.event"
|
||||
|
||||
local function player_joined(event)
|
||||
|
@ -111,6 +111,9 @@ local function on_tick()
|
||||
end
|
||||
|
||||
local function entity_build(event)
|
||||
if not event.created_entity.valid then
|
||||
return
|
||||
end
|
||||
if event.created_entity.name == "nuclear-reactor" then
|
||||
table.insert(global.reactors, event.created_entity)
|
||||
end
|
||||
|
@ -496,39 +496,3 @@ function print_admins(msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
--[[
|
||||
function check_name(function_name)
|
||||
for i,v in pairs(global.scenario.custom_functions) do
|
||||
if v.name == function_name:lower() then
|
||||
return i
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function add_global_event(event, func, name)
|
||||
local p = game.player and game.player.print or print
|
||||
if not event then p("Missing event parameter") return end
|
||||
if not func then p("Missing function parameter") return end
|
||||
if not name then p("Missing name parameter") return end
|
||||
if check_name(name) then p("Function name \""..name.."\" already in use.") return end
|
||||
table.insert(global.scenario.custom_functions, {event = event, name = name, func = func})
|
||||
Event.add(event, func)
|
||||
end
|
||||
|
||||
function remove_global_event(name)
|
||||
local reg = check_name(name)
|
||||
if reg then
|
||||
Event.remove(global.scenario.custom_functions[reg].event, global.scenario.custom_functions[reg].func)
|
||||
table.remove(global.scenario.custom_functions, reg)
|
||||
else
|
||||
game.print("Function with name \""..name.."\" not found")
|
||||
end
|
||||
end
|
||||
|
||||
Event.add(-2, function()
|
||||
for i,v in pairs(global.scenario.custom_functions) do
|
||||
Event.add(v.event, v.func)
|
||||
end
|
||||
end)
|
||||
]]
|
Loading…
x
Reference in New Issue
Block a user