Skip to content
Lemonymous edited this page Jul 6, 2023 · 3 revisions

This page describes functions of Board that have been added or changed as part of memedit.

  • For a page about the Board class as defined in vanilla version of the game, see Vanilla Board
  • For a page about the Board class functions added by the mod loader, see Board.

 

Table of Contents

 

Board

 

GetFireType

  • number   Board:GetFireType(loc)
Argument name Type Description
loc Point The location of the board tile we want to check

  Returns the integer for the fire type on the specified tile.

Terrain Health
FIRE_TYPE_NONE 0
FIRE_TYPE_NORMAL_FIRE 1
FIRE_TYPE_FOREST_FIRE 2

 

Example:

local loc = Point(0,0) 
LOGF("Tile %s has fire type %s",
	loc:GetString(),
	Board:GetFireType(loc)
)

 

GetHighlighted

  • Point   Board:GetHighlighted()

  Returns the location of the tile currently being highlighted; or nil if no tile is being highlighted.

Example:

local highlighted = Board:GetHighlighted() 
if highlighted then 
	LOGF("Tile %s is being highlighted", highlighted:GetString()) 
else 
	LOG("No tile is being highlighted") 
end

 

GetAttackOrder

  • number   Board:GetAttackOrder()

  After pressing end turn, the game goes through a few phases; fire -> lightning -> etc -> enemy attacks -> enemy spawns. This function returns an integer from 0-6 indicating some of these phases. It can not identify when the enemy carry out attacks or spawn. It will stay at its idle state 6 during that time.

Constant Integer Notes
ATTACK_ORDER_START 0 unknown if this index have any more specific meaning
ATTACK_ORDER_FIRE 1
ATTACK_ORDER_LIGHTNING 2
ATTACK_ORDER_TENTACLES 3
ATTACK_ORDER_REGENERATION 4
ATTACK_ORDER_TECHNICIAN 5 unconfirmed, but the best guess so far
ATTACK_ORDER_IDLE 6 The idle value until next end turn

Example:

LOG("Current Attack Order =", Board:GetAttackOrder()) 

 

GetMaxHealth

  • number   Board:GetMaxHealth(loc)
Argument name Type Description
loc Point The location of the board tile we want to check

  Returns the maximum health of a tile.

Example:

local loc = Point(0,0) 
LOGF("Tile %s has %s maximum health",
	loc:GetString(),
	Board:GetMaxHealth(loc)
)

 

GetRubbleType

  • int   Board:GetRubbleType(loc)
Argument name Type Description
loc Point The location of the board tile we want to check

  Returns an integer indicating what kind of rubble type a tile has. It can be either mountain rubble or building rubble.

Constant Integer
RUBBLE_MOUNTAIN 0
RUBBLE_BUILDING 1

Example:

local loc = Point(0,0) 
LOGF("The rubble type of tile %s is %s", 
	loc:GetString(), 
	Board:GetRubbleType(loc) 
)

 

GetTerrainIcon

  • string   Board:GetTerrainIcon(loc)
Argument name Type Description
loc Point The location of the board tile we want to check

  Returns the name of the terrain icon being displayed on a tile, or an empty string if no terrain icon is being displayed. This is the same name specified when setting a terrain icon with Board.SetTerrainIcon.

Example:

local loc = Point(0,0) 
LOGF("Tile %s has terrain icon %s",
	loc:GetString(),
	Board:GetTerrainIcon(loc)
)

 

GetUniqueBuilding

  • string   Board:GetUniqueBuilding(loc)
Argument name Type Description
loc Point The location of the board tile we want to check

  Returns the name of the unique building on a board tile. Returns nil for tiles with no unique building.

Example:

local loc = Point(0,0) 
LOGF("Tile %s has unique building %q",
	loc:GetString(),
	tostring(Board:GetUniqueBuilding(loc))
)

 

IsForest

  • boolean   Board:IsForest(loc)
Argument name Type Description
loc Point The location of the board tile we want to check

  Returns true if the specified tile is a forest or if it is a forest on fire. false otherwise.

Example:

local loc = Point(0,0) 
LOGF("Tile %s is a forest is %s",
	loc:GetString(),
	Board:IsForest(loc)
)

 

IsForestFire

  • boolean   Board:IsForestFire(loc)
Argument name Type Description
loc Point The location of the board tile we want to check

  Returns true if the specified tile is a forest on fire. false otherwise.

Example:

local loc = Point(0,0) 
LOGF("Tile %s is a forest on fire is %s",
	loc:GetString(),
	Board:IsForestFire(loc)
)

 

IsHighlighted

  • boolean   Board:IsHighlighted()

  Returns true if any tile on the board is being highlighted, otherwise false.

Example:

LOGF("Board is being highlighted is %s", Board:IsHighlighted())

 

IsShield

  • boolean   Board:IsShield(loc)
Argument name Type Description
loc Point The location of the board tile we want to check

  Returns true if the specified tile is shielded. false otherwise.

Example:

local loc = Point(0,0) 
LOGF("Tile %s is shielded is %s",
	loc:GetString(),
	Board:IsShield(loc)
)

 

RemoveItem

  • void   Board:RemoveItem(loc)
Argument name Type Description
loc Point The location of the board tile we want to remove from

  Removes the item (usually a mine) from a tile if it has one; otherwise does nothing.

Example:

local loc = Point(0,0) 
Board:RemoveItem(loc) 

 

SetRubbleType

  • void   Board:SetRubbleType(loc, rubble_type)
Argument name Type Description
loc Point The location of the board tile we want to set
rubble_type number The rubble type we want to set

  Sets the rubble type of the specified tile. Changing a tile to mountain or building will also change the rubble type of a tile.

Constant Integer
RUBBLE_MOUNTAIN 0
RUBBLE_BUILDING 1

Example:

local loc = Point(0,0) 
Board:SetTerrain(loc, TERRAIN_BUILDING) 
Board:SetTerrain(loc, TERRAIN_RUBBLE) 
Board:SetRubbleType(loc, RUBBLE_MOUNTAIN) 

 

SetAcid

  • void   Board:SetAcid(loc, acid, no_animation)
  • void   Board:SetAcid(loc, acid)
  • Original function moved to SetAcidVanilla
Argument name Type Description
loc Point The location of the board tile we want to change
acid boolean Whether to set or unset acid on the tile
no_animation boolean Whether to skip sounds and animation or not

  Applies acid to specified tile if acid is true, or removed it if false.

If no_animation is true, the tile will become frozen/unfrozen immediately, skipping all animation and sounds normally associated with freeze/unfreeze.

Example:

local loc = Point(0,0) 
local acid = true 
local no_animation = true 
Board:SetAcid(loc, acid, no_animation)

 

SetFrozen

  • void   Board:SetFrozen(loc, frozen, no_animation)
  • void   Board:SetFrozen(loc, frozen)
  • Original function moved to SetFrozenVanilla
Argument name Type Description
loc Point The location of the board tile we want to change
frozen boolean Whether to freeze or unfreeze the tile
no_animation boolean Whether to skip sounds and animation or not

  Freezes the specified tile if frozen is true, or unfreezes it if false.

If no_animation is true, sounds and animations are skipped, and the effect is applied immediately.

Example:

local loc = Point(0,0) 
local frozen = true 
local no_animation = true 
Board:SetFrozen(loc, frozen, no_animation)

 

SetShield

  • void   Board:SetShield(loc, shield, no_animation)
  • void   Board:SetShield(loc, shield)
Argument name Type Description
loc Point The location of the board tile we want to change
shield boolean Whether to shield or remove shield from the tile
no_animation boolean Whether to skip the shield/unshield animation

  Shields the specified tile if shield is true, or unshields it if false.

If no_animation is true, sounds and animations are skipped, and the effect is applied immediately.

Example:

local loc = Point(0,0) 
local shield = true 
local no_animation = true 
Board:SetShield(loc, shield, no_animation)

 

SetUniqueBuilding

  • void   Board:SetUniqueBuilding(loc, structureId)
Argument name Type Description
loc Point The location of the board tile we want to change
structureId string The structure id we want to add

  Sets the unique building on a tile to a specified structure id. If "", any current unique building will be removed.

Example:

local loc = Point(0,0) 
local structureId = "str_bar1" 
Board:SetUniqueBuilding(loc, structureId)