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:
parent
43a0b0b1a5
commit
14a6dae5e3
@ -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
|
||||
|
@ -94,7 +94,7 @@ local function walkabout(cmd)
|
||||
return
|
||||
end
|
||||
local chunks = {}
|
||||
for chunk in player.surface.get_chunks() do
|
||||
for chunk in player.surface.get_chunks() do
|
||||
table.insert(chunks, chunk)
|
||||
end
|
||||
|
||||
@ -102,9 +102,9 @@ local function walkabout(cmd)
|
||||
if not chunk then
|
||||
return
|
||||
end
|
||||
local pos = {x=chunk.x * 32, y=chunk.y * 32}
|
||||
local pos = {x=chunk.x * 32, y=chunk.y * 32}
|
||||
local non_colliding_pos = player.surface.find_non_colliding_position("player", pos, 100, 1)
|
||||
|
||||
|
||||
if non_colliding_pos then
|
||||
game.print(player_name .. " went on a walkabout, to find himself.")
|
||||
Task.set_timeout(duration, "custom_commands_return_player", {player = player, force = player.force, position = {x = player.position.x, y = player.position.y}})
|
||||
@ -113,7 +113,7 @@ local function walkabout(cmd)
|
||||
player.teleport(non_colliding_pos)
|
||||
player.force = "enemy"
|
||||
global.walking[player_name:lower()] = true
|
||||
else
|
||||
else
|
||||
player_print("Walkabout failed: count find non colliding position")
|
||||
end
|
||||
end
|
||||
@ -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)
|
||||
|
@ -19,7 +19,7 @@ local function entity_destroyed(event)
|
||||
end
|
||||
|
||||
function spawn_wasteland(surface, position)
|
||||
local positions = {
|
||||
local positions = {
|
||||
{0, 0},
|
||||
{0, 12},
|
||||
{0, -12},
|
||||
@ -88,10 +88,10 @@ local function check_wastelands()
|
||||
for index,wl in pairs(global.wastelands) do
|
||||
local age = game.tick - wl.creation_time
|
||||
wl.last_checked = wl.last_checked or 0
|
||||
if (game.tick - wl.last_checked) > 899 then
|
||||
if (game.tick - wl.last_checked) > 899 then
|
||||
wl.last_checked = game.tick
|
||||
spawn_wasteland(game.surfaces[wl.surface_id], wl.position)
|
||||
if age > wasteland_duration_seconds * 60 - 1 then
|
||||
if age > wasteland_duration_seconds * 60 - 1 then
|
||||
global.wastelands[index] = nil
|
||||
reactors = game.surfaces[wl.surface_id].find_entities_filtered{position = wl.position, name = "nuclear-reactor"}
|
||||
if reactors[1] then reactors[1].destroy() end
|
||||
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user