Files
fulpstation/code/__HELPERS/verbs.dm
A miscellaneous Fern f3397e3136 January TGU - First Draft (#879)
* Update beefman.dm

* Update beefman.dm

* xsaxsfvvvvvvvv

* Update shaded_bloodsucker.dm

* yeah that thing

* FUCK you

* Update hunting_contract.dm

* dd

* vdvdfv

* Update monsterhunter_weapons.dm

* Update whiterabbit.dm

* onokkn

* Update monsterhunter_weapons.dm

* Update monsterhunter_weapons.dm

* efe

* Update whiterabbit.dm

* yeaywa

* Update red_rabbit.dmi

* oihop

* Update HunterContract.js

* wonderland.dm

* gs

* dcd

* Update rabbit.dmi

* ass

* fvd

* Update paradox_rabbit.dm

* f

* Update tgstation.dme

* Delete heartbeatmoon.dmi

* shtntb

* sed

* sfe

* Update monsterhunter_weapons.dm

* cdc

* Update wonderland.dm

* dgrd

* wef

* b

* pipkk

* Update hunting_contract.dm

* Update paradox_rabbit.dm

* wr

* Update worn_mask.dmi

* some documenting

* Update areas.dm

* eg

* Update white_rabbit.dm

* Update HunterContract.js

* s

* Update weapons.dmi

* Update weapons.dmi

* Jack in the bomb

* some signals

* ui

* h

* y

* music

* Update wonderlandmusic.ogg

* f

* v

* cleanups

* g

* a

* t

* y

* g

* a

* o

* first commit

* Adding our stuff back in

* k

* Before procs

* proc refs

* carps

* Fixes

* shuttles

* dumb dumb names

* I hate windows I hate windows

* I hate windows I hate windows

* h

* Selenestation has issues

* Update monsterhunter_weapons.dm

* eretics

* Update weapons.dmi

* Update monsterhunter_weapons.dm

* g

* kpop

* r

* m

* grgr

* Update simple_animal_freeze.dm

* Update wonderland_apocalypse.dm

* Update wonderland_apocalypse.dm

* d

* Update fulp_defines.dm

* ff

* Update wonderland.dmm

* Update tgstation.dme

* Update infil_objectives.dm

* Update infil_objectives.dm

* Update monsterhunter_weapons.dm

* Update monsterhunter_event.dm

* Update monsterhunter_event.dm

* Update areas.dm

* Update monsterhunter_event.dm

* Update monsterhunter_weapons.dm

* Step 0, version 2

* step 0.5 - version 2

* step 1 - version 2

* 2.5 version 2

* fix

* Mapping

* okay fine

* more mapping

* uuuuu
hhhh

* fixes

* help me

* hurry

* I'm killing the mf that did access helpers on this map

* Welp, we lost.

* Or did we?

---------

Co-authored-by: SmoSmoSmoSmok <95004236+SmoSmoSmoSmok@users.noreply.github.com>
Co-authored-by: Pepsilawn <reisenrui@gmail.com>
Co-authored-by: SgtHunk <68669754+SgtHunk@users.noreply.github.com>
2023-02-01 03:57:55 -03:00

99 lines
3.2 KiB
Plaintext

/**
* handles adding verbs and updating the stat panel browser
*
* pass the verb type path to this instead of adding it directly to verbs so the statpanel can update
* Arguments:
* * target - Who the verb is being added to, client or mob typepath
* * verb - typepath to a verb, or a list of verbs, supports lists of lists
*/
/proc/add_verb(client/target, verb_or_list_to_add)
if(!target)
CRASH("add_verb called without a target")
if(IsAdminAdvancedProcCall())
return
var/mob/mob_target = null
if(ismob(target))
mob_target = target
target = mob_target.client
else if(!istype(target, /client))
CRASH("add_verb called on a non-mob and non-client")
var/list/verbs_list = list()
if(!islist(verb_or_list_to_add))
verbs_list += verb_or_list_to_add
else
var/list/verb_listref = verb_or_list_to_add
var/list/elements_to_process = verb_listref.Copy()
while(length(elements_to_process))
var/element_or_list = elements_to_process[length(elements_to_process)] //Last element
elements_to_process.len--
if(islist(element_or_list))
elements_to_process += element_or_list //list/a += list/b adds the contents of b into a, not the reference to the list itself
else
verbs_list += element_or_list
if(mob_target)
mob_target.verbs += verbs_list
if(!target)
return //Our work is done.
else
target.verbs += verbs_list
var/list/output_list = list()
for(var/thing in verbs_list)
var/procpath/verb_to_add = thing
output_list[++output_list.len] = list(verb_to_add.category, verb_to_add.name)
target.stat_panel.send_message("add_verb_list", output_list)
SEND_SIGNAL(target, COMSIG_CLIENT_VERB_ADDED, verbs_list)
/**
* handles removing verb and sending it to browser to update, use this for removing verbs
*
* pass the verb type path to this instead of removing it from verbs so the statpanel can update
* Arguments:
* * target - Who the verb is being removed from, client or mob typepath
* * verb - typepath to a verb, or a list of verbs, supports lists of lists
*/
/proc/remove_verb(client/target, verb_or_list_to_remove)
if(IsAdminAdvancedProcCall())
return
var/mob/mob_target = null
if(ismob(target))
mob_target = target
target = mob_target.client
else if(!istype(target, /client))
CRASH("remove_verb called on a non-mob and non-client")
var/list/verbs_list = list()
if(!islist(verb_or_list_to_remove))
verbs_list += verb_or_list_to_remove
else
var/list/verb_listref = verb_or_list_to_remove
var/list/elements_to_process = verb_listref.Copy()
while(length(elements_to_process))
var/element_or_list = elements_to_process[length(elements_to_process)] //Last element
elements_to_process.len--
if(islist(element_or_list))
elements_to_process += element_or_list //list/a += list/b adds the contents of b into a, not the reference to the list itself
else
verbs_list += element_or_list
if(mob_target)
mob_target.verbs -= verbs_list
if(!target)
return //Our work is done.
else
target.verbs -= verbs_list
var/list/output_list = list()
for(var/thing in verbs_list)
var/procpath/verb_to_remove = thing
output_list[++output_list.len] = list(verb_to_remove.category, verb_to_remove.name)
target.stat_panel.send_message("remove_verb_list", output_list)
SEND_SIGNAL(target, COMSIG_CLIENT_VERB_REMOVED, verbs_list)