mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 11:07:12 +01:00
* refactor: Attack chain, initial setup. * migrate curtain to make dreamchecker happy * update thurible * don't call attacked_by separately for legacy attack chain * remove duplicate proc * condense similar code, put allowances for legacy code in new procs * update docs, include diagram source * add comment on how to update diagram * fix admonition * mindflayer updates * remove commented out code * clarify all steps * after_attack should be overridable * whoops * retrofit recent changes * duh, can't restrict this yet because of tool_acts * i hate ore bags with the fire of a thousand suns * return correct value for object attack logic * Various cleanups. We don't want to attempt to pull stuff out of `/obj/item/attackby`, because those pieces are part of the related objects' migrations, not `/obj/item` itself. Attempting to do this causes knockon effects where things expected to call e.g. `/obj/item/storage/attackby` in the call chain were not ferried over to the new item interaction code, because the related objects hadn't actually been migrated over yet. I've used refactoring /obj/vehicle as the example for migrating `attackby` methods instead. * simplify some argument names * fuck it * make it do the thing * Rename CI module call * Prove that CI works * improve test output * aaand fix it again * fix curtain tool interactions * fix compile error * fix compile error * Better docs, introduce migration plan tool.
132 lines
4.4 KiB
Plaintext
132 lines
4.4 KiB
Plaintext
/**********************Lazarus Injector**********************/
|
|
/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/hypo.dmi'
|
|
icon_state = "lazarus_hypo"
|
|
item_state = "hypo"
|
|
origin_tech = "biotech=4;magnets=6"
|
|
throwforce = 0
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
throw_speed = 3
|
|
throw_range = 5
|
|
var/loaded = 1
|
|
var/malfunctioning = 0
|
|
var/revive_type = SENTIENCE_ORGANIC //So you can't revive boss monsters or robots with it
|
|
|
|
/obj/item/lazarus_injector/afterattack__legacy__attackchain(atom/target, mob/user, proximity_flag)
|
|
if(!loaded)
|
|
return
|
|
if(isliving(target) && proximity_flag)
|
|
if(isanimal(target))
|
|
var/mob/living/simple_animal/M = target
|
|
if(M.sentience_type != revive_type)
|
|
to_chat(user, "<span class='notice'>[src] does not work on this sort of creature.</span>")
|
|
return
|
|
if(M.stat == DEAD)
|
|
M.faction = list("neutral")
|
|
M.revive()
|
|
M.set_can_collar(TRUE)
|
|
if(ishostile(target))
|
|
var/mob/living/simple_animal/hostile/H = M
|
|
if(isretaliate(target))
|
|
// Clear the enemies list so we don't break windows
|
|
// to get to people we no longer hate.
|
|
var/mob/living/simple_animal/hostile/retaliate/R = H
|
|
R.enemies.Cut()
|
|
|
|
if(malfunctioning)
|
|
H.faction |= list("lazarus", "\ref[user]")
|
|
H.robust_searching = TRUE
|
|
H.friends += user
|
|
H.attack_same = TRUE
|
|
log_game("[user] has revived hostile mob [target] with a malfunctioning lazarus injector")
|
|
else
|
|
H.attack_same = FALSE
|
|
loaded = 0
|
|
user.visible_message("<span class='notice'>[user] injects [M] with [src], reviving it.</span>")
|
|
playsound(src,'sound/effects/refill.ogg',50,1)
|
|
icon_state = "lazarus_empty"
|
|
return
|
|
else
|
|
to_chat(user, "<span class='notice'>[src] is only effective on the dead.</span>")
|
|
return
|
|
else
|
|
to_chat(user, "<span class='notice'>[src] is only effective on lesser beings.</span>")
|
|
return
|
|
|
|
/obj/item/lazarus_injector/emag_act(mob/user)
|
|
if(!malfunctioning)
|
|
malfunctioning = 1
|
|
to_chat(user, "<span class='notice'>You override [src]'s safety protocols.</span>")
|
|
return TRUE
|
|
|
|
/obj/item/lazarus_injector/emp_act()
|
|
if(!malfunctioning)
|
|
malfunctioning = 1
|
|
|
|
/obj/item/lazarus_injector/examine(mob/user)
|
|
. = ..()
|
|
if(!loaded)
|
|
. += "<span class='notice'>[src] is empty.</span>"
|
|
if(malfunctioning)
|
|
. += "<span class='notice'>The display on [src] seems to be flickering.</span>"
|
|
|
|
/*********************Mob Capsule*************************/
|
|
|
|
/obj/item/mobcapsule
|
|
name = "lazarus capsule"
|
|
desc = "It allows you to store and deploy lazarus-injected creatures easier."
|
|
icon = 'icons/obj/mobcap.dmi'
|
|
icon_state = "mobcap0"
|
|
w_class = WEIGHT_CLASS_TINY
|
|
throw_range = 7
|
|
var/mob/living/simple_animal/captured = null
|
|
var/colorindex = 0
|
|
var/capture_type = SENTIENCE_ORGANIC //So you can't capture boss monsters or robots with it
|
|
|
|
/obj/item/mobcapsule/Destroy()
|
|
if(captured)
|
|
captured.ghostize()
|
|
QDEL_NULL(captured)
|
|
return ..()
|
|
|
|
/obj/item/mobcapsule/attack__legacy__attackchain(mob/living/simple_animal/S, mob/user, prox_flag)
|
|
if(istype(S) && S.sentience_type == capture_type)
|
|
capture(S, user)
|
|
return TRUE
|
|
return ..()
|
|
|
|
/obj/item/mobcapsule/proc/capture(mob/living/simple_animal/S, mob/living/M)
|
|
if(captured)
|
|
to_chat(M, "<span class='notice'>Capture failed!</span>: The capsule already has a mob registered to it!")
|
|
else
|
|
if("neutral" in S.faction)
|
|
S.forceMove(src)
|
|
S.name = "[M.name]'s [initial(S.name)]"
|
|
S.cancel_camera()
|
|
name = "Lazarus Capsule: [initial(S.name)]"
|
|
to_chat(M, "<span class='notice'>You placed a [S.name] inside the Lazarus Capsule!</span>")
|
|
captured = S
|
|
else
|
|
to_chat(M, "You can't capture that mob!")
|
|
|
|
/obj/item/mobcapsule/throw_impact(atom/A, mob/user)
|
|
..()
|
|
if(captured)
|
|
dump_contents(user)
|
|
|
|
/obj/item/mobcapsule/proc/dump_contents(mob/user)
|
|
if(captured)
|
|
captured.forceMove(get_turf(src))
|
|
captured = null
|
|
|
|
/obj/item/mobcapsule/attack_self__legacy__attackchain(mob/user)
|
|
colorindex += 1
|
|
if(colorindex >= 6)
|
|
colorindex = 0
|
|
update_icon(UPDATE_ICON_STATE)
|
|
|
|
/obj/item/mobcapsule/update_icon_state()
|
|
icon_state = "mobcap[colorindex]"
|