ops/factorio/multiworld: add debugrenameworld
This commit is contained in:
parent
ee8ec5263a
commit
e005a5fd6e
2 changed files with 567 additions and 580 deletions
|
@ -46,8 +46,13 @@ achievement disabling flag.
|
||||||
This is intended for use for admins to import existing save files as new
|
This is intended for use for admins to import existing save files as new
|
||||||
surfaces.
|
surfaces.
|
||||||
|
|
||||||
Note that once you've done so, you'll need to use the `/debugresetworldstate`
|
Note that once you've done so, you'll need to use the `/debugrenameworld` or
|
||||||
command in order to properly set up the extra metadata required by Multiworld.
|
`/debugresetworldstate` commands in order to properly set up the extra metadata
|
||||||
|
required by Multiworld.
|
||||||
|
|
||||||
|
### `/debugrenameworld <OLD NAME> <NEW NAME>` - rename a surface (admins only)
|
||||||
|
|
||||||
|
This is useful for renaming worlds imported by the `/debugeditor`.
|
||||||
|
|
||||||
### `/debugresetworldstate <WORLD NAME>` - reset book-keeping metadata for a world (admins only)
|
### `/debugresetworldstate <WORLD NAME>` - reset book-keeping metadata for a world (admins only)
|
||||||
|
|
||||||
|
|
|
@ -334,21 +334,6 @@ local function reset_inventories(surface, p)
|
||||||
global.inventories[surface.name] = {}
|
global.inventories[surface.name] = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function reset_locations(surface, p)
|
|
||||||
if global.locations == nil then
|
|
||||||
global.locations = {}
|
|
||||||
end
|
|
||||||
if global.locations[surface.name] ~= nil then
|
|
||||||
p('Destroying locations for surface ' .. surface.name, c)
|
|
||||||
for player_idx, location in pairs(global.locations[surface.name]) do
|
|
||||||
p(' .. ' .. game.players[player_idx].name .. ' (' .. location.x ..
|
|
||||||
', ' .. location.y .. ')', c)
|
|
||||||
-- We don't do anything here, this is just for logging purposes.
|
|
||||||
end
|
|
||||||
end
|
|
||||||
global.locations[surface.name] = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
local function destroy_world(name, p)
|
local function destroy_world(name, p)
|
||||||
local surface = get_surface_by_name(name)
|
local surface = get_surface_by_name(name)
|
||||||
if surface == nil then
|
if surface == nil then
|
||||||
|
@ -369,7 +354,6 @@ local function destroy_world(name, p)
|
||||||
game.delete_surface(surface)
|
game.delete_surface(surface)
|
||||||
|
|
||||||
reset_inventories(surface, p)
|
reset_inventories(surface, p)
|
||||||
reset_locations(surface, p)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function create_world(name, map_gen_settings, p)
|
local function create_world(name, map_gen_settings, p)
|
||||||
|
@ -385,7 +369,6 @@ local function create_world(name, map_gen_settings, p)
|
||||||
local force = game.create_force(force_name_for_surface(surface))
|
local force = game.create_force(force_name_for_surface(surface))
|
||||||
|
|
||||||
reset_inventories(surface, p)
|
reset_inventories(surface, p)
|
||||||
reset_locations(surface, p)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function destroyworld_command(cmd)
|
local function destroyworld_command(cmd)
|
||||||
|
@ -515,7 +498,6 @@ local function debugresetworldstate_command(cmd)
|
||||||
local force = game.create_force(force_name_for_surface(surface))
|
local force = game.create_force(force_name_for_surface(surface))
|
||||||
|
|
||||||
reset_inventories(surface, p)
|
reset_inventories(surface, p)
|
||||||
reset_locations(surface, p)
|
|
||||||
|
|
||||||
local force = force_for_surface(surface)
|
local force = force_for_surface(surface)
|
||||||
local player_owned_entities = surface.find_entities_filtered {
|
local player_owned_entities = surface.find_entities_filtered {
|
||||||
|
|
Loading…
Reference in a new issue