lockable
Extension for giving an object a code lock, with it's own ui.
Vars | |
code | The passcode currently inputed so far and what is displayed on the UI. |
---|---|
emagged | Whether or not the lock is emagged. |
error | Error text currently displayed to the user. Temporary. |
is_digital_lock | Whether or not the lock is digital, and its ability to be brute forced. |
l_code | The code to unlock the lock |
l_hacking | Whether or not the lock is being hacked. |
l_set | Whether or not the lock has been set. |
l_setshort | Whether or not the ability to set the lock is broken. |
locked | Whether the lock is locked. |
max_code_length | Max length of the password. |
open | Whether or not the lock service panel is open. |
opening_panel | Whether we're currently opening the panel or not. (Unskilled people can take a long time to open it) |
sound_range | The absolute range in turfs the lockable's sounds can be heard at from the holder's position. |
Procs | |
attackby | Item attack handler for interactions with the host. |
bad_access_attempt | Called after the user enters the wrong keycode, or fails a hacking attempt. |
can_interact | Whether the user can actually issue commands to the ui. |
clear_button | Clears the currently entered code and the current error text, and lock the lockable if it's not already. |
clear_current_code | Clear the currently entered code on the ui. |
clear_error | Clear the currently displayed error text on the ui. |
confirm_code | Called when the user press the enter key on the lockable keypad, or when the last key of the code is entered. Either sets the keycode for unlocking this lockable, or checks if the current keycode entered is the correct one, and unlocks the lockable. Returns TRUE if the code entered was appropriate. |
emag_act | Called when an emag is used on the holder. |
enter_number | Called whenever the user input a number key. Adds the value of the key to the currently entered keycode. |
hack_fail_chance | Returns a percent chance of the given user failing at hacking this lock. |
is_locked | Whether the lockable is currently locked or not. |
is_setting_keycode | Whether we're currently awaiting a keycode input to set the keycode to unlock this lockable. |
keycode_issues_text | Checks the given code for any issues with using it as this lockable's keycode. Returns null if there are no problems. Or a text string describing the problem otherwise. |
matches_keycode | Whether the incoming keycode matches the keycode we have set to unlock this lockable. |
play_code_set_sound | Makes the holder play the sound after a new keycode has been set. |
play_failure_sound | Makes the holder play the failure sound, when an invalid operation has been done. |
play_key_sound | Makes the holder play a sound when a keypad key has been pressed. |
play_lock_sound | Makes the holder play the lock's locking sound. |
play_success_sound | Makes the holder play the success sound, when an operation was successful. |
play_unlock_sound | Makes the holder play the lock's unlock sound. |
pressed_key | Process keypresses coming from the nanoUI. |
reset_memory | Clears the currently set keycode, hacked state, and shorted state. Called by the hacking proc via timer after a short delay. |
set_error_message | Sets the error message to be displayed currently. |
set_keycode | Sets the keycode that unlocks this lockable. |
set_locked | Locks or unlocks the lockable. And play a sound. |
toggle_panel | Opens the "service panel" for nefarious purposes. |
try_hack | Called when a multitool is used on the holder to hack the device. |
Var Details
code
The passcode currently inputed so far and what is displayed on the UI.
emagged
Whether or not the lock is emagged.
error
Error text currently displayed to the user. Temporary.
is_digital_lock
Whether or not the lock is digital, and its ability to be brute forced.
l_code
The code to unlock the lock
l_hacking
Whether or not the lock is being hacked.
l_set
Whether or not the lock has been set.
l_setshort
Whether or not the ability to set the lock is broken.
locked
Whether the lock is locked.
max_code_length
Max length of the password.
open
Whether or not the lock service panel is open.
opening_panel
Whether we're currently opening the panel or not. (Unskilled people can take a long time to open it)
sound_range
The absolute range in turfs the lockable's sounds can be heard at from the holder's position.
Proc Details
attackby
Item attack handler for interactions with the host.
bad_access_attempt
Called after the user enters the wrong keycode, or fails a hacking attempt.
can_interact
Whether the user can actually issue commands to the ui.
clear_button
Clears the currently entered code and the current error text, and lock the lockable if it's not already.
clear_current_code
Clear the currently entered code on the ui.
clear_error
Clear the currently displayed error text on the ui.
confirm_code
Called when the user press the enter key on the lockable keypad, or when the last key of the code is entered. Either sets the keycode for unlocking this lockable, or checks if the current keycode entered is the correct one, and unlocks the lockable. Returns TRUE if the code entered was appropriate.
emag_act
Called when an emag is used on the holder.
enter_number
Called whenever the user input a number key. Adds the value of the key to the currently entered keycode.
hack_fail_chance
Returns a percent chance of the given user failing at hacking this lock.
is_locked
Whether the lockable is currently locked or not.
is_setting_keycode
Whether we're currently awaiting a keycode input to set the keycode to unlock this lockable.
keycode_issues_text
Checks the given code for any issues with using it as this lockable's keycode. Returns null if there are no problems. Or a text string describing the problem otherwise.
matches_keycode
Whether the incoming keycode matches the keycode we have set to unlock this lockable.
play_code_set_sound
Makes the holder play the sound after a new keycode has been set.
play_failure_sound
Makes the holder play the failure sound, when an invalid operation has been done.
play_key_sound
Makes the holder play a sound when a keypad key has been pressed.
- key: A single key character that was pressed. Any leters between A to Z, any numbers between 0-9, or *, #, ⌗, ⚹.
- user: The user inputing the key.
- user_only: If set, the key sound will only be sent to the client using the keypad.
play_lock_sound
Makes the holder play the lock's locking sound.
play_success_sound
Makes the holder play the success sound, when an operation was successful.
play_unlock_sound
Makes the holder play the lock's unlock sound.
pressed_key
Process keypresses coming from the nanoUI.
reset_memory
Clears the currently set keycode, hacked state, and shorted state. Called by the hacking proc via timer after a short delay.
set_error_message
Sets the error message to be displayed currently.
set_keycode
Sets the keycode that unlocks this lockable.
set_locked
Locks or unlocks the lockable. And play a sound.
toggle_panel
Opens the "service panel" for nefarious purposes.
try_hack
Called when a multitool is used on the holder to hack the device.