mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-25 04:57:12 +01:00
[TM] Verb Queue - Port of TG SSverb subsystem (#19863)
* Some verbs queue up now * Damn you 515 * Screw you Topic * Update client_procs.dm * Fixes for unit testing * Update MC.dm * verb * Update callback.dm * Tweaks * Linters might not have liked that, * More tweaks, and fix * Update verb_manager.dm
This commit is contained in:
@@ -177,6 +177,7 @@ GLOBAL_LIST_INIT(admin_verbs_debug, list(
|
||||
/client/proc/dmapi_log,
|
||||
/client/proc/timer_log,
|
||||
/client/proc/debug_timers,
|
||||
/client/proc/force_verb_bypass,
|
||||
))
|
||||
GLOBAL_LIST_INIT(admin_verbs_possess, list(
|
||||
/proc/possess,
|
||||
|
||||
@@ -173,8 +173,18 @@
|
||||
if("openLink")
|
||||
src << link(href_list["link"])
|
||||
|
||||
//fun fact: Topic() acts like a verb and is executed at the end of the tick like other verbs. So we have to queue it if the server is
|
||||
//overloaded
|
||||
if(hsrc && hsrc != holder && DEFAULT_TRY_QUEUE_VERB(VERB_CALLBACK(src, PROC_REF(_Topic), hsrc, href, href_list)))
|
||||
return
|
||||
|
||||
..() //redirect to hsrc.Topic()
|
||||
|
||||
///dumb workaround because byond doesnt seem to recognize the Topic() typepath for /datum/proc/Topic() from the client Topic,
|
||||
///so we cant queue it without this
|
||||
/client/proc/_Topic(datum/hsrc, href, list/href_list)
|
||||
return hsrc.Topic(href, href_list)
|
||||
|
||||
|
||||
/client/proc/get_display_key()
|
||||
var/fakekey = holder?.fakekey
|
||||
|
||||
@@ -745,7 +745,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
//this is a mob verb instead of atom for performance reasons
|
||||
//see /mob/verb/examinate() in mob.dm for more info
|
||||
//overriden here and in /mob/living for different point span classes and sanity checks
|
||||
/mob/dead/observer/pointed(atom/A as mob|obj|turf in view())
|
||||
/mob/dead/observer/run_pointed(atom/A as mob|obj|turf in view())
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/follow_link
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
set name = "quick-equip"
|
||||
set hidden = 1
|
||||
|
||||
|
||||
DEFAULT_QUEUE_OR_CALL_VERB(VERB_CALLBACK(src, PROC_REF(run_quick_equip)))
|
||||
|
||||
///proc extender of [/mob/verb/quick_equip] used to make the verb queuable if the server is overloaded
|
||||
/mob/proc/run_quick_equip()
|
||||
var/obj/item/I = get_active_hand()
|
||||
if(I)
|
||||
I.equip_to_best_slot(src)
|
||||
|
||||
@@ -249,6 +249,9 @@
|
||||
return FALSE
|
||||
if(HAS_TRAIT(src, TRAIT_FAKEDEATH))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/mob/living/run_pointed(atom/A)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/item/hand_item = get_active_hand()
|
||||
@@ -721,6 +724,10 @@
|
||||
set name = "Resist"
|
||||
set category = "IC"
|
||||
|
||||
DEFAULT_QUEUE_OR_CALL_VERB(VERB_CALLBACK(src, PROC_REF(run_resist)))
|
||||
|
||||
///proc extender of [/mob/living/verb/resist] meant to make the process queable if the server is overloaded when the verb is called
|
||||
/mob/living/proc/run_resist()
|
||||
if(!can_resist())
|
||||
return
|
||||
changeNext_move(CLICK_CD_RESIST)
|
||||
|
||||
@@ -843,8 +843,8 @@
|
||||
else
|
||||
return null
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/resist()
|
||||
..()
|
||||
/mob/living/simple_animal/bot/mulebot/run_resist()
|
||||
. = ..()
|
||||
if(load)
|
||||
unload()
|
||||
|
||||
|
||||
@@ -95,8 +95,7 @@
|
||||
else
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/diona/resist()
|
||||
..()
|
||||
/mob/living/simple_animal/diona/run_resist()
|
||||
split()
|
||||
|
||||
/mob/living/simple_animal/diona/attack_hand(mob/living/carbon/human/M)
|
||||
|
||||
@@ -597,6 +597,9 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
|
||||
set name = "Examine"
|
||||
set category = "IC"
|
||||
|
||||
DEFAULT_QUEUE_OR_CALL_VERB(VERB_CALLBACK(src, PROC_REF(run_examinate), A))
|
||||
|
||||
/mob/proc/run_examinate(atom/A)
|
||||
if(!has_vision(information_only = TRUE) && !isobserver(src))
|
||||
to_chat(src, "<span class='notice'>Something is there but you can't see it.</span>")
|
||||
return 1
|
||||
@@ -649,6 +652,10 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
|
||||
set category = null
|
||||
set src = usr
|
||||
|
||||
DEFAULT_QUEUE_OR_CALL_VERB(VERB_CALLBACK(src, PROC_REF(run_mode)))
|
||||
|
||||
///proc version to finish /mob/verb/mode() execution. used in case the proc needs to be queued for the tick after its first called
|
||||
/mob/proc/run_mode()
|
||||
if(ismecha(loc)) return
|
||||
|
||||
if(hand)
|
||||
@@ -1569,3 +1576,13 @@ GLOBAL_LIST_INIT(holy_areas, typecacheof(list(
|
||||
. = stat
|
||||
stat = new_stat
|
||||
SEND_SIGNAL(src, COMSIG_MOB_STATCHANGE, new_stat, .)
|
||||
|
||||
///Makes a call in the context of a different usr. Use sparingly
|
||||
/world/proc/invoke_callback_with_usr(mob/user_mob, datum/callback/invoked_callback, ...)
|
||||
var/temp = usr
|
||||
usr = user_mob
|
||||
if (length(args) > 2)
|
||||
. = invoked_callback.Invoke(arglist(args.Copy(3)))
|
||||
else
|
||||
. = invoked_callback.Invoke()
|
||||
usr = temp
|
||||
|
||||
@@ -104,6 +104,14 @@
|
||||
if(istype(A, /obj/effect/temp_visual/point) || istype(A, /atom/movable/emissive_blocker))
|
||||
return FALSE
|
||||
|
||||
DEFAULT_QUEUE_OR_CALL_VERB(VERB_CALLBACK(src, PROC_REF(run_pointed), A))
|
||||
|
||||
/// possibly delayed verb that finishes the pointing process starting in [/mob/verb/pointed()].
|
||||
/// either called immediately or in the tick after pointed() was called, as per the [DEFAULT_QUEUE_OR_CALL_VERB()] macro
|
||||
/mob/proc/run_pointed(atom/A)
|
||||
if(client && !(A in view(client.view, src)))
|
||||
return FALSE
|
||||
|
||||
changeNext_move(CLICK_CD_POINT)
|
||||
if(A.loc in src) // Object is inside a container on the mob. It's not part of the verb's list since it's not in view and requires middle clicking.
|
||||
point_at(A)
|
||||
|
||||
Reference in New Issue
Block a user