mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-17 05:31:53 +00:00
Hacktool (#1607)
* Adds hacking tool. In normal mode a hacking tool acts and functions just like any multitool. Use a screwdriver to toggle between normal and hacking mode. Hacking attempts will take 20 +(0 to 20) seconds (triangular distribution, averages at +10 seconds). Once an airlock has been successfully hacked the user will have full access to the door operation interface normally restricted to silicons. A hacking tool will remember the last 6 to 8 hacked airlocks. No time is needed to again hack remembered airlocks. Once the limit has been reached the least recently accessed airlock is forgotten. Hacking a remembered airlock will update the last accessed time. Also adds a basic observer/listener pattern implementation to, for example, make it easier to catch when objects have been destroyed and clear references. * Corrects and adds more sanity checking. * Adds hacktool to uplink devices
This commit is contained in:
@@ -1,87 +1,87 @@
|
||||
/**
|
||||
* Startup hook.
|
||||
* Called in world.dm when the server starts.
|
||||
*/
|
||||
/hook/startup
|
||||
|
||||
/**
|
||||
* Roundstart hook.
|
||||
* Called in gameticker.dm when a round starts.
|
||||
*/
|
||||
/hook/roundstart
|
||||
|
||||
/**
|
||||
* Roundend hook.
|
||||
* Called in gameticker.dm when a round ends.
|
||||
*/
|
||||
/hook/roundend
|
||||
|
||||
/**
|
||||
* Death hook.
|
||||
* Called in death.dm when someone dies.
|
||||
* Parameters: var/mob/living/carbon/human, var/gibbed
|
||||
*/
|
||||
/hook/death
|
||||
|
||||
/**
|
||||
* Cloning hook.
|
||||
* Called in cloning.dm when someone is brought back by the wonders of modern science.
|
||||
* Parameters: var/mob/living/carbon/human
|
||||
*/
|
||||
/hook/clone
|
||||
|
||||
/**
|
||||
* Debrained hook.
|
||||
* Called in brain_item.dm when someone gets debrained.
|
||||
* Parameters: var/obj/item/organ/brain
|
||||
*/
|
||||
/hook/debrain
|
||||
|
||||
/**
|
||||
* Borged hook.
|
||||
* Called in robot_parts.dm when someone gets turned into a cyborg.
|
||||
* Parameters: var/mob/living/silicon/robot
|
||||
*/
|
||||
/hook/borgify
|
||||
|
||||
/**
|
||||
* Podman hook.
|
||||
* Called in podmen.dm when someone is brought back as a Diona.
|
||||
* Parameters: var/mob/living/carbon/alien/diona
|
||||
*/
|
||||
/hook/harvest_podman
|
||||
|
||||
/**
|
||||
* Payroll revoked hook.
|
||||
* Called in Accounts_DB.dm when someone's payroll is stolen at the Accounts terminal.
|
||||
* Parameters: var/datum/money_account
|
||||
*/
|
||||
/hook/revoke_payroll
|
||||
|
||||
/**
|
||||
* Account suspension hook.
|
||||
* Called in Accounts_DB.dm when someone's account is suspended or unsuspended at the Accounts terminal.
|
||||
* Parameters: var/datum/money_account
|
||||
*/
|
||||
/hook/change_account_status
|
||||
|
||||
/**
|
||||
* Employee reassignment hook.
|
||||
* Called in card.dm when someone's card is reassigned at the HoP's desk.
|
||||
* Parameters: var/obj/item/weapon/card/id
|
||||
*/
|
||||
/hook/reassign_employee
|
||||
|
||||
/**
|
||||
* Employee terminated hook.
|
||||
* Called in card.dm when someone's card is terminated at the HoP's desk.
|
||||
* Parameters: var/obj/item/weapon/card/id
|
||||
*/
|
||||
/hook/terminate_employee
|
||||
|
||||
/**
|
||||
* Crate sold hook.
|
||||
* Called in supplyshuttle.dm when a crate is sold on the shuttle.
|
||||
* Parameters: var/obj/structure/closet/crate/sold, var/area/shuttle
|
||||
*/
|
||||
/hook/sell_crate
|
||||
/**
|
||||
* Startup hook.
|
||||
* Called in world.dm when the server starts.
|
||||
*/
|
||||
/hook/startup
|
||||
|
||||
/**
|
||||
* Roundstart hook.
|
||||
* Called in gameticker.dm when a round starts.
|
||||
*/
|
||||
/hook/roundstart
|
||||
|
||||
/**
|
||||
* Roundend hook.
|
||||
* Called in gameticker.dm when a round ends.
|
||||
*/
|
||||
/hook/roundend
|
||||
|
||||
/**
|
||||
* Death hook.
|
||||
* Called in death.dm when someone dies.
|
||||
* Parameters: var/mob/living/carbon/human, var/gibbed
|
||||
*/
|
||||
/hook/death
|
||||
|
||||
/**
|
||||
* Cloning hook.
|
||||
* Called in cloning.dm when someone is brought back by the wonders of modern science.
|
||||
* Parameters: var/mob/living/carbon/human
|
||||
*/
|
||||
/hook/clone
|
||||
|
||||
/**
|
||||
* Debrained hook.
|
||||
* Called in brain_item.dm when someone gets debrained.
|
||||
* Parameters: var/obj/item/organ/brain
|
||||
*/
|
||||
/hook/debrain
|
||||
|
||||
/**
|
||||
* Borged hook.
|
||||
* Called in robot_parts.dm when someone gets turned into a cyborg.
|
||||
* Parameters: var/mob/living/silicon/robot
|
||||
*/
|
||||
/hook/borgify
|
||||
|
||||
/**
|
||||
* Podman hook.
|
||||
* Called in podmen.dm when someone is brought back as a Diona.
|
||||
* Parameters: var/mob/living/carbon/alien/diona
|
||||
*/
|
||||
/hook/harvest_podman
|
||||
|
||||
/**
|
||||
* Payroll revoked hook.
|
||||
* Called in Accounts_DB.dm when someone's payroll is stolen at the Accounts terminal.
|
||||
* Parameters: var/datum/money_account
|
||||
*/
|
||||
/hook/revoke_payroll
|
||||
|
||||
/**
|
||||
* Account suspension hook.
|
||||
* Called in Accounts_DB.dm when someone's account is suspended or unsuspended at the Accounts terminal.
|
||||
* Parameters: var/datum/money_account
|
||||
*/
|
||||
/hook/change_account_status
|
||||
|
||||
/**
|
||||
* Employee reassignment hook.
|
||||
* Called in card.dm when someone's card is reassigned at the HoP's desk.
|
||||
* Parameters: var/obj/item/weapon/card/id
|
||||
*/
|
||||
/hook/reassign_employee
|
||||
|
||||
/**
|
||||
* Employee terminated hook.
|
||||
* Called in card.dm when someone's card is terminated at the HoP's desk.
|
||||
* Parameters: var/obj/item/weapon/card/id
|
||||
*/
|
||||
/hook/terminate_employee
|
||||
|
||||
/**
|
||||
* Crate sold hook.
|
||||
* Called in supplyshuttle.dm when a crate is sold on the shuttle.
|
||||
* Parameters: var/obj/structure/closet/crate/sold, var/area/shuttle
|
||||
*/
|
||||
/hook/sell_crate
|
||||
|
||||
31
code/controllers/observer_listener/atom/observer.dm
Normal file
31
code/controllers/observer_listener/atom/observer.dm
Normal file
@@ -0,0 +1,31 @@
|
||||
#define OBSERVER_EVENT_DESTROY "OnDestroy"
|
||||
|
||||
/atom
|
||||
var/list/observer_events
|
||||
|
||||
/atom/Destroy()
|
||||
var/list/destroy_listeners = get_listener_list_from_event(OBSERVER_EVENT_DESTROY)
|
||||
if(destroy_listeners)
|
||||
for(var/destroy_listener in destroy_listeners)
|
||||
call(destroy_listener, destroy_listeners[destroy_listener])(src)
|
||||
|
||||
for(var/list/listeners in observer_events)
|
||||
listeners.Cut()
|
||||
|
||||
return ..()
|
||||
|
||||
/atom/proc/register(var/event, var/procOwner, var/proc_call)
|
||||
var/list/listeners = get_listener_list_from_event(event)
|
||||
listeners[procOwner] = proc_call
|
||||
|
||||
/atom/proc/unregister(var/event, var/procOwner)
|
||||
var/list/listeners = get_listener_list_from_event(event)
|
||||
listeners -= procOwner
|
||||
|
||||
/atom/proc/get_listener_list_from_event(var/observer_event)
|
||||
if(!observer_events) observer_events = list()
|
||||
var/list/listeners = observer_events[observer_event]
|
||||
if(!listeners)
|
||||
listeners = list()
|
||||
observer_events[observer_event] = listeners
|
||||
return listeners
|
||||
28
code/controllers/observer_listener/datum/observer.dm
Normal file
28
code/controllers/observer_listener/datum/observer.dm
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
#define OBSERVER_EVENT_DESTROY "OnDestroy"
|
||||
|
||||
/datum
|
||||
var/list/observer_events
|
||||
|
||||
/datum/Destroy()
|
||||
for(var/list/listeners in observer_events)
|
||||
listeners.Cut()
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/proc/register(var/event, var/procOwner, var/proc_call)
|
||||
var/list/listeners = get_listener_list_from_event(event)
|
||||
listeners[procOwner] = proc_call
|
||||
|
||||
/datum/proc/unregister(var/event, var/procOwner)
|
||||
var/list/listeners = get_listener_list_from_event(event)
|
||||
listeners -= procOwner
|
||||
|
||||
/datum/proc/get_listener_list_from_event(var/observer_event)
|
||||
if(!observer_events) observer_events = list()
|
||||
var/list/listeners = observer_events[observer_event]
|
||||
if(!listeners)
|
||||
listeners = list()
|
||||
observer_events[observer_event] = listeners
|
||||
return listeners
|
||||
*/
|
||||
Reference in New Issue
Block a user