wires
Vars | |
assemblies | An associative list of signalers attached to the wires. The wire color is the key, and the signaler object reference is the value. |
---|---|
colors | An associative list with the wire color as the key, and the wire define as the value. |
cut_wires | A list of all cut wires. The same values that can go into wires will get added and removed from this list. |
holder | The atom the wires belong too. For example: an airlock. |
holder_type | The holder type; used to make sure that the holder is the correct type. |
labelled | TRUE if the wires are labelled for every user |
proper_name | The display name for the TGUI window. For example, given the var is "APC"... When the TGUI window is opened, "wires" will be appended to it's title, and it would become "APC wires". |
randomize | TRUE if the wires will be different every time a new wire datum is created. |
wire_count | The total number of wires that our holder atom has. |
wires | A list of all wires. For a list of valid wires defines that can go here, see code/__DEFINES/wires.dm |
Procs | |
Interact | Proc called when the user attempts to interact with wires UI. |
add_duds | Adds in dud wires, which do nothing when cut/pulsed. |
attach_assembly | Proc called when a mob tries to attach a signaler to a wire. |
cut | Cut or mend a wire. Calls on_cut() . |
cut_all | Cuts all wires. |
cut_color | Cut the wire which corresponds with the passed in color. |
cut_random | Cuts a random wire. |
detach_assembly | Proc called when a mob tries to detach a signaler from a wire. |
emp_pulse | Use this proc if you want wires to be pulsed on EMP |
get_attached | Gets the signaler attached to the given wire color, if there is one. |
get_status | Base proc, intended to be overwritten. Put wire information you'll see at the botton of the TGUI window here, such as "The red light is blinking". |
get_wire | Gets the wire associated with the color passed in. |
get_wire_name | Get the name of the wire passed in. If wires can't be read, may either return something scrambled or nothing at all. A null return here means that there should be no name displayed at all. |
interactable | Base proc, intended to be overriden. Wire datum specific checks you want to run before the TGUI is shown to the user should go here. |
is_all_cut | Determines if all of the wires are cut. Returns TRUE they're all cut, FALSE otherwise. |
is_attached | Checks if the given wire has a signaler on it. |
is_color_cut | Determines if the wire associated with the passed in color, is cut or not. Returns TRUE if it's cut, FALSE otherwise. |
is_cut | Determines if the passed in wire is cut or not. Returns TRUE if it's cut, FALSE otherwise. |
is_dud | Determines if the passed in wire is a dud or not. Returns TRUE if the wire is a dud, FALSE otherwise. |
is_dud_color | Returns TRUE if the wire that corresponds to the passed in color is a dud. FALSE otherwise. |
on_cut | Proc called when any wire is cut. |
on_pulse | Proc called when any wire is pulsed. |
pulse | Pulses the given wire. Calls on_pulse() . |
pulse_assembly | Proc called when an attached signaler receives a signal. |
pulse_color | Pulses the wire associated with the given color. |
randomize | Randomly generates a new set of wires. and corresponding colors from the given pool. Assigns the information as an associative list, to colors . |
repair | Repairs all cut wires. |
shuffle_wires | Clears the colors list, and randomizes it to a new set of color-to-wire relations. |
ui_host | Users will be interacting with our holder object and not the wire datum directly, therefore we need to return the holder. |
Var Details
assemblies
An associative list of signalers attached to the wires. The wire color is the key, and the signaler object reference is the value.
colors
An associative list with the wire color as the key, and the wire define as the value.
cut_wires
A list of all cut wires. The same values that can go into wires
will get added and removed from this list.
holder
The atom the wires belong too. For example: an airlock.
holder_type
The holder type; used to make sure that the holder is the correct type.
labelled
TRUE if the wires are labelled for every user
proper_name
The display name for the TGUI window. For example, given the var is "APC"... When the TGUI window is opened, "wires" will be appended to it's title, and it would become "APC wires".
randomize
TRUE if the wires will be different every time a new wire datum is created.
wire_count
The total number of wires that our holder atom has.
wires
A list of all wires. For a list of valid wires defines that can go here, see code/__DEFINES/wires.dm
Proc Details
Interact
Proc called when the user attempts to interact with wires UI.
Checks if the user exists, is a mob, the wires are attached to something (holder
) and makes sure interactable(user)
returns TRUE.
If all the checks succeed, open the TGUI interface for the user.
Arugments:
- user - the mob trying to interact with the wires.
add_duds
Adds in dud wires, which do nothing when cut/pulsed.
Arguments:
- duds - the amount of dud wires to generate.
attach_assembly
Proc called when a mob tries to attach a signaler to a wire.
Makes sure that S
is actually a signaler and that something is not already attached to the wire.
Adds the signaler to the assemblies
list as a value, with the color
as a the key.
Arguments:
- color - the wire color.
- S - the signaler that a mob is trying to attach.
cut
Cut or mend a wire. Calls on_cut()
.
Arugments:
- wire - a wire define, NOT a color. For example
WIRE_ELECTRIFY
.
cut_all
Cuts all wires.
cut_color
Cut the wire which corresponds with the passed in color.
Arugments:
- color - a wire color.
cut_random
Cuts a random wire.
detach_assembly
Proc called when a mob tries to detach a signaler from a wire.
First checks if there is a signaler on the wire. If so, removes the signaler, and clears it from assemblies
list.
Arguments:
- color - the wire color.
emp_pulse
Use this proc if you want wires to be pulsed on EMP
get_attached
Gets the signaler attached to the given wire color, if there is one.
Arguments:
- color - the wire color.
get_status
Base proc, intended to be overwritten. Put wire information you'll see at the botton of the TGUI window here, such as "The red light is blinking".
get_wire
Gets the wire associated with the color passed in.
Arugments:
- color - a wire color.
get_wire_name
Get the name of the wire passed in. If wires can't be read, may either return something scrambled or nothing at all. A null return here means that there should be no name displayed at all.
Arguments:
- wire - a wire define.
interactable
Base proc, intended to be overriden. Wire datum specific checks you want to run before the TGUI is shown to the user should go here.
is_all_cut
Determines if all of the wires are cut. Returns TRUE they're all cut, FALSE otherwise.
is_attached
Checks if the given wire has a signaler on it.
Arguments:
- color - the wire color.
is_color_cut
Determines if the wire associated with the passed in color, is cut or not. Returns TRUE if it's cut, FALSE otherwise.
Arugments:
- wire - a wire color.
is_cut
Determines if the passed in wire is cut or not. Returns TRUE if it's cut, FALSE otherwise.
Arugments:
- wire - a wire define, NOT a color. For example
WIRE_ELECTRIFY
.
is_dud
Determines if the passed in wire is a dud or not. Returns TRUE if the wire is a dud, FALSE otherwise.
Arugments:
- wire - a wire define, NOT a color. For example
WIRE_ELECTRIFY
.
is_dud_color
Returns TRUE if the wire that corresponds to the passed in color is a dud. FALSE otherwise.
Arugments:
- color - a wire color.
on_cut
Proc called when any wire is cut.
Base proc, intended to be overriden. Place an behavior you want to happen when certain wires are cut, into this proc.
Arugments:
- wire - a wire define, NOT color. For example 'WIRE_ELECTRIFY'.
- mend - TRUE if we're mending the wire. FALSE if we're cutting.
on_pulse
Proc called when any wire is pulsed.
Base proc, intended to be overriden. Place behavior you want to happen when certain wires are pulsed, into this proc.
Arugments:
- wire - a wire define, NOT color. For example 'WIRE_ELECTRIFY'.
pulse
Pulses the given wire. Calls on_pulse()
.
Arugments:
- wire - a wire define, NOT a color. For example
WIRE_ELECTRIFY
.
pulse_assembly
Proc called when an attached signaler receives a signal.
Searches through the assemblies
list for the wire that the signaler is attached to. Pulses the wire when it's found.
Arugments:
- S - the attached signaler receiving the signal.
pulse_color
Pulses the wire associated with the given color.
Arugments:
- wire - a wire color.
randomize
Randomly generates a new set of wires. and corresponding colors from the given pool. Assigns the information as an associative list, to colors
.
In the colors
list, the name of the color is the key, and the wire is the value.
For example: colors["red"] = WIRE_ELECTRIFY
. This will look like list("red" = WIRE_ELECTRIFY)
internally.
repair
Repairs all cut wires.
shuffle_wires
Clears the colors
list, and randomizes it to a new set of color-to-wire relations.
ui_host
Users will be interacting with our holder object and not the wire datum directly, therefore we need to return the holder.