/tg/ Station 13 - Modules - TypesVar Details - Proc Details

training_machine

Machine that runs around wildly so people can practice clickin on things

Can have a mob buckled on or a obj/item/target attached. Movement controlled by SSFastProcess, movespeed controlled by cooldown macros. Can attach obj/item/target, obj/item/training_toolbox, and can buckle mobs to this.

Vars

attached_itemReference to a potentially attached object, either a target, trainer toolbox, or syndicate toolbox
attack_cooldownHelper for timing attacks when emagged
move_cooldownCooldown macro to control how fast this will move. Used in process()
move_speedDelay between process() calls. Cannot be higher than MAX_SPEED. Smaller value represents faster movement.
movingIs the machine moving? Setting this to FALSE will automatically call stop_moving()
rangeThe distance the machine is allowed to roam from its starting point
starting_turfThe turf the machine was on when it was activated
target_positionA random spot within range that the trainer is trying to reach

Procs

DestroyCalled on qdel(), so we don't want a cool explosion to happen
atom_destructionCalled on a normal destruction, so we have a cool explosion and toss whatever's attached
attach_itemAttach an item to the machine
attackbyCalled when the machien is attacked by something
emag_actEmagging causes a deadly, unremovable syndicate toolbox to be attached to the machine
find_target_positionFind a suitable turf to move towards
handle_densityMake sure the machine can't be walked through if something is attached
on_attached_deleteCalled when the attached item is deleted.
processMain movement method for the machine
remove_attached_itemRemove the attached item from the machine
start_movingStart the machine's movement
stop_movingStop the machine's movement
toggleToggle the machine's movement
try_attackTry to attack a nearby mob
ui_actControl the attached variables.
ui_dataSend data to the UI

Var Details

attached_item

Reference to a potentially attached object, either a target, trainer toolbox, or syndicate toolbox

attack_cooldown

Helper for timing attacks when emagged

move_cooldown

Cooldown macro to control how fast this will move. Used in process()

move_speed

Delay between process() calls. Cannot be higher than MAX_SPEED. Smaller value represents faster movement.

moving

Is the machine moving? Setting this to FALSE will automatically call stop_moving()

range

The distance the machine is allowed to roam from its starting point

starting_turf

The turf the machine was on when it was activated

target_position

A random spot within range that the trainer is trying to reach

Proc Details

Destroy

Called on qdel(), so we don't want a cool explosion to happen

atom_destruction

Called on a normal destruction, so we have a cool explosion and toss whatever's attached

attach_item

Attach an item to the machine

This proc technically works with any obj. Currently is only used for objects of type item/target and item/training_toolbox Will make the attached item appear visually on the machine Arguments

attackby

Called when the machien is attacked by something

Meant for attaching an item to the machine, should only be a training toolbox or target. If emagged, the machine will gain an auto-attached syndicate toolbox, so in that case we shouldn't be able to swap it out

emag_act

Emagging causes a deadly, unremovable syndicate toolbox to be attached to the machine

find_target_position

Find a suitable turf to move towards

handle_density

Make sure the machine can't be walked through if something is attached

on_attached_delete

Called when the attached item is deleted.

Cleans up behavior for when the attached item is deleted or removed.

process

Main movement method for the machine

Handles movement using SSFastProcess. Moves randomly, point-to-point, in an area centered around wherever it started. Will only move if the move_cooldown cooldown macro is finished. If it can't find a place to go, it will stop moving.

remove_attached_item

Remove the attached item from the machine

Called when a user removes the item by hand or by swapping it out with another, when the machine breaks, or when the machine is emagged. Arguments

start_moving

Start the machine's movement

Says a message, plays a sound, then starts processing

stop_moving

Stop the machine's movement

Will call STOP_PROCESSING, play a sound, and say an appropriate message Arguments

toggle

Toggle the machine's movement

try_attack

Try to attack a nearby mob

Called whenever the machine moves, this will look for mobs adjacent to the machine to attack. Will attack with either a training toolbox (if attached), or a much more deadly syndicate toolbox (if emagged). A cooldown macro (attack_cooldown) ensures it doesn't attack too quickly

ui_act

Control the attached variables.

Will not respond if moving and emagged, so once you set it to go it can't be stopped!

ui_data

Send data to the UI

Include's the machine's movement range, speed, and whether or not it's active