Control Module - Warps - Stores warps for each force.
-- Making a new spawn warp
local player = game.player
local force = player.force
local spawn_id = Warps.add_warp(force.name, player.surface, player.position, player.name, 'Spawn')
Warps.set_spawn_warp(spawn_id, force)
Warps.make_warp_tag(spawn_id)
-- Making a new warp with a warp area
local player = game.player
local force = player.force
local warp_id = Warps.add_warp(force.name, player.surface, player.position, player.name)
Warps.make_warp_area(warp_id)
Warps.make_warp_tag(warp_id)
expcore.datastore |
utils.global |
config.warps |
get_warp(warp_id) | Gets the warp information that is linked with this id |
get_force_warp_ids(force_name) | Gets all the warp ids that a force has |
get_spawn_warp_id(force_name) | Get the id of the spawn warp |
get_editing(warp_id, player_name) | Gets the editing state for a player |
add_warp(force_name, surface, position[, player_name][, warp_name]) | Add a new warp for a force, the warp must have a surface and a position |
remove_warp(warp_id) | Removes a warp and any data linked to it |
update_warp(warp_id[, new_name][, new_icon][, player_name='server']) | Update the name and icon for a warp |
set_editing(warp_id, player_name, state) | Set the editing state for a player, can be used as a warning or to display a text field |
on_update(handler) | Adds an update handler for when a warp is added, removed, or updated |
make_warp_tag(warp_id) | Add or update the chat tag for this warp |
remove_warp_tag(warp_id) | Remove the chart tag for this warp |
make_warp_area(warp_id) | Add a warp area for the warp, purely cosmetic |
remove_warp_area(warp_id) | Remove the warp area for a warp |
set_spawn_warp(warp_id, force) | Set a warp to be the spawn point for a force, force must own this warp |
teleport_player(warp_id, player) | Teleport a player to a warp point |
Gets the warp information that is linked with this id
Parameters:-- Getting warp information outside of on_update
local warp = Warps.get_warp(warp_id)
Gets all the warp ids that a force has
Parameters:-- Getting the warp ids for a force
local warp_ids = Warps.get_force_warp_ids(game.player.force.name)
Get the id of the spawn warp
Parameters:-- Getting the spawn warp id
local spawn_id = Warps.get_spawn_warp_id(game.player.force.name)
Gets the editing state for a player
Parameters:-- Check if a player is editing a warp or not
local editing = Warps.get_editing(warp_id, game.player.name)
Add a new warp for a force, the warp must have a surface and a position
Parameters:-- Adding a new warp for your force at your position
local player = game.player
local warp_id = Warps.add_warp(player.force.name, player.surface, player.position, player.name)
Removes a warp and any data linked to it
Parameters:-- Removing a warp
Warps.remove_warp(warp_id)
Update the name and icon for a warp
Parameters:-- Changing the name and icon for a warp
Warps.update_warp(warp_id, 'My Warp', 'iron-plate', game.player.name)
Set the editing state for a player, can be used as a warning or to display a text field
Parameters:-- Setting your editing state to true
Warps.set_editing(warp_id, game.player.name, true)
Adds an update handler for when a warp is added, removed, or updated
Parameters:-- Add a game print when a warp is updated
Warps.on_update(function(warp)
game.print(warp.force_name..' now has the warp: '..warp.name)
end)
Add or update the chat tag for this warp
Parameters:-- Adding a chart tag for a new warp
local tag_added = Warps.make_warp_tag(warp_id)
Remove the chart tag for this warp
Parameters:-- Removing the chart tag from a warp
local removed = Warps.remove_warp_tag(warp_id)
Add a warp area for the warp, purely cosmetic
Parameters:-- Adding a warp area for a warp
Warps.make_warp_area(warp_id)
Remove the warp area for a warp
Parameters:-- Remove the warp area for a warp
Warps.remove_warp_area(warp_id)
Set a warp to be the spawn point for a force, force must own this warp
Parameters:-- Set your forces spawn to a warp
Warps.set_spawn_warp(warp_id, game.player.force)