ig.

EntitySwitch

new EntitySwitch()

Entity that acts as a presence activated trigger. Tip: if you're going to use a switch to open a door, make sure it is a triggered door!

Author:
  • Collin Hover - collinhover.com
Source:

autoBreak :Boolean

Whether to become automatically broken after open or close.

Default Value:
  • false
Source:

autoToggle

Switches should automatically toggle back to default state.

Default Value:
  • true
Source:

blocked :Boolean

Switches can be blocked and not open or close. Will play directional "openBlocked" animation if blocked while closed, and directional "closeBlocked" animation if blocked while open.

Default Value:
  • false
Source:

broken :Boolean

Switches can be broken and not open or close. Will play directional "broken" animation.

Default Value:
  • false
Source:

triggerable

Switches should be triggerable through collision.

Default Value:
  • true
Source:

activate()

Activates switch and opens.

Source:

block()

Blocks switch and plays directional "openBlocked" (when closed) or "closeBlocked" (when open) animation. Use when something is blocking switch, such as vines or rubble.

Source:

close()

Closes switch and plays directional "open" animation.

Source:

deactivate()

Deactivates switch and closes.

Source:

fix()

Fixes switch and stops playing directional "broken" animation.

Source:

getCanClose(entity) → {Boolean}

Checks if switch can close.

Parameters:
Name Type Description
entity ig.EntityExtended entity trying to cause close.
Source:
Returns:
{ Boolean } whether switch can close.

getCanOpen(entity) → {Boolean}

Checks if switch can open.

Parameters:
Name Type Description
entity ig.EntityExtended entity trying to cause open.
Source:
Returns:
{ Boolean } whether switch can open.

getCanTrigger()

Switches need to be able to open to be triggered.

Source:

initTypes()

Initializes switch types.
- adds ig.EntityExtended.TYPE.SWITCH to {@link ig.EntityExtended#type}
- adds ig.EntityExtended.TYPE.CHARACTER to {@link ig.EntityExtended#checkAgainst}

Source:

malfunction()

Breaks switch and plays directional "broken" animation.

Source:

open()

Opens switch and plays directional "open" animation.

Source:

spawn()

Source:

unblock()

Unblocks switch and stops playing directional "blocked" animation.

Source: