1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

Fixed uranium decon. Added commands all-tech, hax, pool, meltdown

This commit is contained in:
Valansch 2018-02-26 16:57:47 +01:00
parent 43a0b0b1a5
commit 14a6dae5e3
3 changed files with 38 additions and 9 deletions

View File

@ -23,6 +23,7 @@ local function mark_if_depleted(drill)
end
local function on_resource_depleted(event)
if event.entity.name == "uranium-ore" then return nil end
local area = {{event.entity.position.x-1, event.entity.position.y-1}, {event.entity.position.x+1, event.entity.position.y + 1}}
local drills = event.entity.surface.find_entities_filtered{area = area, type="mining-drill"}
for _,drill in pairs(drills) do

View File

@ -435,6 +435,29 @@ local function zoom(cmd)
end
end
local function pool()
if game.player and game.player.admin then
local t = {} p = game.player.position
for x = p.x - 3, p.x + 3 do
for y = p.y + 2, p.y + 7 do
table.insert(t, {name="water", position={x,y}})
end
end
game.player.surface.set_tiles(t)
game.player.surface.create_entity{name = "fish", position = {p.x + 0.5, p.y + 5}}
end
end
local function reactor_toggle()
if not game.player or game.player.admin then
global.reactors_enabled = not global.reactors_enabled
if global.reactors_enabled then
game.print("Reactor meltdown activated.")
else
game.print("Reactor meltdown deactivated.")
end
end
end
commands.add_command("kill", "Will kill you.", kill)
commands.add_command("tpplayer", "<player> - Teleports you to the player. (Admins and moderators)", teleport_player)
commands.add_command("invoke", "<player> - Teleports the player to you. (Admins and moderators)", invoke)
@ -455,3 +478,7 @@ commands.add_command("forcetoggle", "Toggles the players force between player an
commands.add_command("tempban", "<player> <minutes> Temporarily bans a player (Admins and moderators)", tempban)
commands.add_command("spyshot", "<player> Sends a screenshot of player to discord. (If a host is online. If no host is online, you can become one yourself. Ask on discord :))", spyshot)
commands.add_command("zoom", "<number> Sets your zoom.", zoom)
commands.add_command("all-tech", "researches all technologies", function() if game.player and game.player.admin then game.player.force.research_all_technologies() end end)
commands.add_command("hax", "Toggles your hax", function() if game.player and game.player.admin then game.player.cheat_mode = not game.player.cheat_mode end end)
commands.add_command("pool", "Spawns a pool", pool)
commands.add_command("meltdown", "Toggles if reactors blow up", reactor_toggle)

View File

@ -100,8 +100,9 @@ local function check_wastelands()
end
end
global.reactors_enabled = true
local function on_tick()
if (game.tick + 7) % 60 == 0 then
if global.reactors_enabled then
check_wastelands()
check_reactors()
end
@ -113,7 +114,7 @@ local function entity_build(event)
end
end
Event.register(defines.events.on_tick, on_tick)
script.on_nth_tick(67, on_tick)
Event.register(defines.events.on_player_mined_entity, entity_destroyed)
Event.register(defines.events.on_robot_mined_entity, entity_destroyed)
Event.register(defines.events.on_entity_died, entity_destroyed)