Map
Based on game build 714014 | Last updated: 2026-03-03
Overview
The Map component encapsulates core world geometry and terrain logic. It is responsible for terrain type checks, valid deployment spot validation, platform and overhang detection, and arena point identification (for boss fights). It serves as the central interface for tile-based spatial reasoning across the game, integrating with components like walkableplatform, pickable, placer, and external helpers (sharkboimanagerhelper, vault_floor_helper, wagpunk_floor_helper).
Usage example
local map = TheWorld.Map
local x, y, z = 10, 0, -20
-- Check if a point is passable land
if map:IsPassableAtPoint(x, y, z, false, false) then
-- Test if deployment is clear of obstacles
local pt = Vector3(x, y, z)
if map:CanDeployAtPoint(pt, inst) then
-- Deploy entity
inst.Transform:SetPosition(x, y, z)
end
end
Dependencies & tags
Components used: walkableplatform, pickable, placer, riftspawner, sharkboimanagerhelper, vault_floor_helper, wagpunk_floor_helper, moonstorms
Tags:
- Uses
walkableplatformfor platform detection. - Checks for
terraformblocker,groundhole,groundtargetblocker,INLIMBO,NOBLOCK,player,FX,DECOR,structure,wall,dockjammer,lunacyarea,nocavein,noquaker,tree,boulder,spiderden,okayforarena,blocker,plant,antlion_sinkhole_blocker,structure,ignorewalkableplatforms. walkableperipheralandwalkableplatformfor peripheral deployment.
Properties
No public properties.
Main functions
Map:SetTile(x, y, tile, ...)
- Description: Overrides the terrain tile at
(x, y)and firesonterraformevent with original and new tile data. - Parameters:
x,y(number) — tile coordinates.tile(number) —WORLD_TILES.*identifier....(vararg) — additional arguments passed to underlyingMap.SetTile.
- Returns: Nothing.
Map:IsPassableAtPoint(x, y, z, allow_water, exclude_boats)
- Description: Checks if point
(x, y, z)is walkable land or valid water (ifallow_wateristrue). Also considers walkable platforms ifexclude_boatsisfalse. - Parameters:
x,y,z(number) — world coordinates.allow_water(boolean) — whether water tiles are considered passable.exclude_boats(boolean) — whether to exclude walkable platforms (e.g., boats).
- Returns:
valid_tile(boolean) —trueif the point is on land or valid water.is_overhang(boolean, optional) —trueif point is in an overhang region.
Map:IsAboveGroundAtPoint(x, y, z, allow_water)
- Description: Returns
trueif(x, y, z)lies on land or ocean tile (not invalid or overhang). - Parameters:
x,y,z(number) — world coordinates.allow_water(boolean) — ignored in implementation (logic only considers tile group).
- Returns:
trueif tile is land or ocean.
Map:CanTerraformAtPoint(x, y, z)
- Description: Verifies that terraforming is allowed at the specified point (e.g., not immune tile, no blockers within
TERRAFORM_EXTRA_SPACING). - Parameters:
x,y,z(number) — world coordinates.
- Returns:
trueif terraforming is allowed.
Map:CanDeployAtPoint(pt, inst, mouseover)
- Description: Checks if an entity can be deployed at
pt, considering terrain passability, deployment spacing, and mouseover type. - Parameters:
pt(Vector3) — deployment point.inst(Entity) — entity being deployed (used for spacing and tags).mouseover(Entity, optional) — currently hovered entity.
- Returns:
trueif deployment is valid.
Map:CanDeployWallAtPoint(pt, inst)
- Description: Specialized deployment check for walls, snapping coordinates to nearest meter grid and applying wall-specific spacing rules.
- Parameters:
pt(Vector3) — target point.inst(Entity) — wall entity being deployed.
- Returns:
trueif wall placement is valid.
Map:CanDeployDockAtPoint(pt, inst, mouseover)
- Description: Validates dock placement on ocean tiles, ensuring no nearby boats and no dock jammers.
- Parameters: Same as
CanDeployAtPoint, but restricted to ocean tiles. - Returns:
trueif dock placement is valid.
Map:CanDeployBridgeAtPointWithFilter(pt, inst, mouseover, tilefilterfn)
- Description: Generic bridge placement check using a custom tile filter (e.g.,
BridgeFilter_Void,BridgeFilter_OceanAndVoid). - Parameters:
tilefilterfn(function) — function(self, tileid) → booleanthat validates tile types.
- Returns:
trueif bridge placement is valid.
Map:CanDeployBoatAtPointInWater(pt, inst, mouseover, data)
- Description: Validates boat deployment on water, checking for proximity to other platforms and ensuring sufficient ocean coverage.
- Parameters:
data(table) — must includeboat_radius,boat_extra_spacing, andmin_distance_from_land.
- Returns:
trueif boat can be deployed.
Map:IsSurroundedByWater(x, y, z, radius)
- Description: Verifies that all points on a square perimeter and interior (within
radius) are ocean tiles. - Parameters:
radius(number) — half-width of the sampling square (inclusive, with +1 internal padding).
- Returns:
trueif the region is fully ocean.
Map:IsDeployPointClear(pt, inst, min_spacing, min_spacing_sq_fn, near_other_fn, check_player, custom_ignore_tags)
- Description: Determines whether deployment at
ptis clear of blocking entities, using spacing rules and tag filters. - Parameters:
inst(Entity, optional) — entity being deployed (excluded from checks).min_spacing(number, optional) — required clearance radius.near_other_fn(function, optional) — custom proximity check function.
- Returns:
trueif no blockers found.
Map:GetLunacyAreaModifier(x, y, z)
- Description: Calculates a mutation spawn chance multiplier based on proximity to lunar anomaly sources (rifts, full moon, moonstorms, lunacy tiles, or lunacy areas).
- Parameters:
x,y,z(number) — world coordinates.
- Returns: Multiplier ≥
1.0(base is1.0, +0.5per active condition).
Map:FindBestSpawningPointForArena(CustomAllowTest, perfect_only, spawnpoints)
- Description: Searches for the best spawning point for a land-based arena, prioritizing points with no obstacles and no players nearby.
- Parameters:
CustomAllowTest(function) — function(map, x, y, z) → booleanfor additional criteria.perfect_only(boolean) — iftrue, only returns ideal (obstacle-free) points.spawnpoints(table, optional) — list of candidate points.
- Returns:
(x, y, z)of best point ornil, nil, nil.
Map:StartFindingGoodArenaPoints()
- Description: Begins background scanning for optimal land arena points (cached for later reuse in arena placement).
- Parameters: None.
- Returns: Nothing.
Map:IsInLunacyArea(x, y, z)
- Description: Checks if the point is in any active lunacy condition (e.g., during moon rift events or on lunacy tiles).
- Parameters:
x,y,z(number) — world coordinates.
- Returns:
trueif lunacy is active.
Map:IsPointInVaultRoom(x, y, z)
- Description: Checks if the point is inside a vault room using replicated vault positioning data.
- Parameters: Same as above.
- Returns:
trueif inside vault room.
Map:IsWagPunkArenaBarrierUp()
- Description: Checks if the WagPunk arena barrier is currently active.
- Parameters: None.
- Returns:
trueif barrier is up.
Map:GetWagPunkArenaCenterXZ()
- Description: Returns the center
(x, z)of the WagPunk arena. - Parameters: None.
- Returns:
(x, z)ornil, nilif not available.
Events & listeners
- Listens to: None (component does not register event listeners directly).
- Pushes:
onterraform— fired byMap:SetTilewhen a tile is changed; includes{x, y, original_tile, tile}.