mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-09 08:23:09 +00:00
Makes the code compatible with 515.1594+
Few simple changes and one very painful one.
Let's start with the easy:
* puts call behind `LIBCALL` define, so call_ext is properly used in 515
* Adds `NAMEOF_STATIC(_,X)` macro for nameof in static definitions since
src is now invalid there.
* Fixes tgui and devserver. From 515 onward the tmp3333{procid} cache
directory is not appened to base path in browser controls so we don't
check for it in base js and put the dev server dummy window file in
actual directory not the byond root.
* Renames the few things that had /final/ in typepath to ultimate since
final is a new keyword
And the very painful change:
`.proc/whatever` format is no longer valid, so we're replacing it with
new nameof() function. All this wrapped in three new macros.
`PROC_REF(X)`,`TYPE_PROC_REF(TYPE,X)`,`GLOBAL_PROC_REF(X)`. Global is
not actually necessary but if we get nameof that does not allow globals
it would be nice validation.
This is pretty unwieldy but there's no real alternative.
If you notice anything weird in the commits let me know because majority
was done with regex replace.
@tgstation/commit-access Since the .proc/stuff is pretty big change.
Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
56 lines
1.8 KiB
Plaintext
56 lines
1.8 KiB
Plaintext
/**
|
|
* Attached to an item, when the item is used to attack a human, and the attacker isn't in combat mode, attempts to equip the item to the target after the normal delay.
|
|
*
|
|
* Uses the compare_zone_to_item_slot() proc to see if the attacker is targeting a valid slot.
|
|
*/
|
|
/datum/element/attack_equip
|
|
|
|
/datum/element/attack_equip/Attach(datum/target)
|
|
. = ..()
|
|
if(!isitem(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
RegisterSignal(target, COMSIG_ITEM_ATTACK, PROC_REF(on_item_attack))
|
|
|
|
/datum/element/attack_equip/Detach(datum/source, ...)
|
|
. = ..()
|
|
|
|
UnregisterSignal(source, COMSIG_ITEM_ATTACK)
|
|
|
|
/datum/element/attack_equip/proc/on_item_attack(obj/item/attire, mob/living/target, mob/living/user)
|
|
SIGNAL_HANDLER
|
|
if(user.combat_mode || !ishuman(target) || target == user)
|
|
return
|
|
|
|
var/mob/living/carbon/human/sharp_dresser = target
|
|
var/targeted_zone = user.zone_selected
|
|
|
|
if(!attire.compare_zone_to_item_slot(targeted_zone))
|
|
return
|
|
|
|
if(attire.mob_can_equip(target, attire.slot_flags, disable_warning = TRUE, bypass_equip_delay_self = TRUE))
|
|
INVOKE_ASYNC(src, PROC_REF(equip), attire, sharp_dresser, user)
|
|
return COMPONENT_CANCEL_ATTACK_CHAIN
|
|
|
|
|
|
/datum/element/attack_equip/proc/equip(obj/item/attire, mob/living/carbon/human/sharp_dresser, mob/living/user)
|
|
|
|
if(HAS_TRAIT(attire, TRAIT_NODROP))
|
|
to_chat(user, span_warning("You can't put [attire] on [sharp_dresser], it's stuck to your hand!"))
|
|
return
|
|
var/equip_time = attire.equip_delay_other
|
|
|
|
attire.item_start_equip(sharp_dresser, attire, user)
|
|
|
|
if(!do_mob(user, sharp_dresser, equip_time))
|
|
return
|
|
|
|
if(!user.Adjacent(sharp_dresser)) // Due to teleporting shenanigans
|
|
user.put_in_hands(attire)
|
|
return
|
|
|
|
user.temporarilyRemoveItemFromInventory(attire)
|
|
|
|
sharp_dresser.equip_to_slot_if_possible(attire, attire.slot_flags)
|
|
|
|
return finish_equip_mob(attire, sharp_dresser, user)
|