mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 20:45:28 +01:00
ff6b41aa07
## About The Pull Request - Afterattack is a very simple proc now: All it does is this, and all it's used for is for having a convenient place to put effects an item does after a successful attack (IE, the attack was not blocked)  - An overwhelming majority of afterattack implementations have been moved to `interact_with_atom` or the new `ranged_interact_with_atom` I have manually tested many of the refactored procs but there was 200+ so it's kinda hard ## Why It's Good For The Game Afterattack is one of the worst parts of the attack chain, as it simultaneously serves as a way of doing random interactions NOT AT ALL related to attacks (despite the name) while ALSO serving as the defacto way to do a ranged interaction with an item This means careless coders (most of them) may throw stuff in afterattack without realizing how wide reaching it is, which causes bugs. By making two well defined, separate procs for handing adjacent vs ranged interactions, it becomes WAY WAY WAY more easy to develop for. If you want to do something when you click on something else and you're adjacent, use `interact_with_atom` If you want to do something when you click on something else and you're not adjacent, use 'ranged_interact_with_atom` This does result in some instances of boilerplate as shown here:  But I think it's acceptable, feel free to oppose if you don't I'm sure we can think of another solution ~~Additionally it makes it easier to implement swing combat. That's a bonus I guess~~ ## Changelog 🆑 Melbert refactor: Over 200 item interactions have been refactored to use a newer, easier-to-use system. Report any oddities with using items on other objects you may see (such as surgery, reagent containers like cups and spray bottles, or construction devices), especially using something at range (such as guns or chisels) refactor: Item-On-Modsuit interactions have changed slightly. While on combat mode, you will attempt to "use" the item on the suit instead of inserting it into the suit's storage. This means being on combat mode while the suit's panel is open will block you from inserting items entirely via click (but other methods such as hotkey, clicking on the storage boxes, and mousedrop will still work). refactor: The detective's scanner will now be inserted into storage items if clicked normally, and will scan the storage item if on combat mode /🆑
68 lines
2.7 KiB
Plaintext
68 lines
2.7 KiB
Plaintext
/**
|
|
* Players can revive simplemobs with this.
|
|
*
|
|
* In-game item that can be used to revive a simplemob once. This makes the mob friendly.
|
|
* Becomes useless after use.
|
|
* Becomes malfunctioning when EMP'd.
|
|
* If a hostile mob is revived with a malfunctioning injector, it will be hostile to everyone except whoever revived it and gets robust searching enabled.
|
|
*/
|
|
/obj/item/lazarus_injector
|
|
name = "lazarus injector"
|
|
desc = "An injector with a cocktail of nanomachines and chemicals, this device can seemingly raise animals from the dead, making them become friendly to the user. Unfortunately, the process is useless on higher forms of life and incredibly costly, so these were hidden in storage until an executive thought they'd be great motivation for some of their employees."
|
|
icon = 'icons/obj/medical/syringe.dmi'
|
|
icon_state = "lazarus_hypo"
|
|
inhand_icon_state = "hypo"
|
|
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
|
|
throwforce = 0
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
throw_speed = 3
|
|
throw_range = 5
|
|
///Can this still be used?
|
|
var/loaded = TRUE
|
|
///Injector malf?
|
|
var/malfunctioning = FALSE
|
|
///So you can't revive boss monsters or robots with it
|
|
var/revive_type = SENTIENCE_ORGANIC
|
|
|
|
/obj/item/lazarus_injector/interact_with_atom(atom/target, mob/living/user, list/modifiers)
|
|
if(!loaded)
|
|
return NONE
|
|
if(SEND_SIGNAL(target, COMSIG_ATOM_ON_LAZARUS_INJECTOR, src, user) & LAZARUS_INJECTOR_USED)
|
|
return ITEM_INTERACT_SUCCESS
|
|
if(!isliving(target))
|
|
return NONE
|
|
|
|
var/mob/living/target_animal = target
|
|
if(!target_animal.compare_sentience_type(revive_type)) // Will also return false if not a basic or simple mob, which are the only two we want anyway
|
|
balloon_alert(user, "invalid creature!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
if(target_animal.stat != DEAD)
|
|
balloon_alert(user, "it's not dead!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
target_animal.lazarus_revive(user, malfunctioning)
|
|
expend(target_animal, user)
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
/obj/item/lazarus_injector/proc/expend(atom/revived_target, mob/user)
|
|
user.visible_message(span_notice("[user] injects [revived_target] with [src], reviving it."))
|
|
SSblackbox.record_feedback("tally", "lazarus_injector", 1, revived_target.type)
|
|
loaded = FALSE
|
|
playsound(src,'sound/effects/refill.ogg',50,TRUE)
|
|
icon_state = "lazarus_empty"
|
|
|
|
/obj/item/lazarus_injector/emp_act(severity)
|
|
. = ..()
|
|
if(. & EMP_PROTECT_SELF)
|
|
return
|
|
if(!malfunctioning)
|
|
malfunctioning = TRUE
|
|
|
|
/obj/item/lazarus_injector/examine(mob/user)
|
|
. = ..()
|
|
if(!loaded)
|
|
. += span_info("[src] is empty.")
|
|
if(malfunctioning)
|
|
. += span_info("The display on [src] seems to be flickering.")
|