mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-09 17:13:36 +00: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.
98 lines
3.8 KiB
Plaintext
98 lines
3.8 KiB
Plaintext
/obj/item/slapper
|
|
name = "slapper"
|
|
desc = "This is how real men fight."
|
|
icon_state = "latexballon"
|
|
item_state = "nothing"
|
|
force = 0
|
|
throwforce = 0
|
|
flags = DROPDEL | ABSTRACT
|
|
attack_verb = list("slapped")
|
|
hitsound = 'sound/weapons/slap.ogg'
|
|
/// How many smaller table smacks we can do before we're out
|
|
var/table_smacks_left = 3
|
|
|
|
/obj/item/slapper/attack__legacy__attackchain(mob/M, mob/living/carbon/human/user)
|
|
user.do_attack_animation(M)
|
|
playsound(M, hitsound, 50, TRUE, -1)
|
|
user.visible_message("<span class='danger'>[user] slaps [M]!</span>", "<span class='notice'>You slap [M]!</span>", "<span class='hear'>You hear a slap.</span>")
|
|
if(iscarbon(M))
|
|
var/mob/living/carbon/C = M
|
|
if(C.IsSleeping())
|
|
C.AdjustSleeping(-15 SECONDS)
|
|
if(force)
|
|
return ..()
|
|
|
|
/obj/item/slapper/attack_self__legacy__attackchain(mob/user)
|
|
. = ..()
|
|
if(!isliving(user))
|
|
return
|
|
var/mob/living/L = user
|
|
L.emote("highfive", intentional = TRUE)
|
|
|
|
/obj/item/slapper/attack_obj__legacy__attackchain(obj/O, mob/living/user, params)
|
|
if(!istype(O, /obj/structure/table))
|
|
return ..()
|
|
|
|
var/obj/structure/table/the_table = O
|
|
|
|
if(user.a_intent == INTENT_HARM && table_smacks_left == initial(table_smacks_left)) // so you can't do 2 weak slaps followed by a big slam
|
|
transform = transform.Scale(1.5) // BIG slap
|
|
if(HAS_TRAIT(user, TRAIT_HULK))
|
|
transform = transform.Scale(2)
|
|
color = COLOR_GREEN
|
|
user.do_attack_animation(the_table)
|
|
if(ishuman(user))
|
|
var/mob/living/carbon/human/human_user = user
|
|
if(istype(human_user.shoes, /obj/item/clothing/shoes/cowboy))
|
|
human_user.say(pick("Hot damn!", "Hoo-wee!", "Got-dang!"))
|
|
playsound(get_turf(the_table), 'sound/effects/tableslam.ogg', 110, TRUE)
|
|
user.visible_message("<b><span class='danger'>[user] slams [user.p_their()] fist down on [the_table]!</span></b>", "<b><span class='danger'>You slam your fist down on [the_table]!</span></b>")
|
|
qdel(src)
|
|
else
|
|
user.do_attack_animation(the_table)
|
|
playsound(get_turf(the_table), 'sound/effects/tableslam.ogg', 40, TRUE)
|
|
user.visible_message("<span class='notice'>[user] slaps [user.p_their()] hand on [the_table].</span>", "<span class='notice'>You slap your hand on [the_table].</span>")
|
|
table_smacks_left--
|
|
if(table_smacks_left <= 0)
|
|
qdel(src)
|
|
|
|
/obj/item/slapper/get_clamped_volume() //Without this, you would hear the slap twice if it has force.
|
|
return 0
|
|
|
|
/obj/item/slapper/parry
|
|
desc = "This is how real men win fights."
|
|
force = 5
|
|
flags = DROPDEL | ABSTRACT | NODROP
|
|
attack_verb = list("slapped", "backhanded", "smacked", "discombobulated")
|
|
table_smacks_left = 10 //Much more smackitude
|
|
|
|
/obj/item/slapper/parry/Initialize(mapload)
|
|
AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.5, _parryable_attack_types = NON_PROJECTILE_ATTACKS, _parry_cooldown = (4 / 3) SECONDS) //75% uptime
|
|
if(isliving(loc))
|
|
var/mob/owner = loc
|
|
RegisterSignal(owner, COMSIG_MOB_WILLINGLY_DROP, TYPE_PROC_REF(/datum, signal_qdel), override = TRUE)
|
|
RegisterSignal(owner, COMSIG_MOB_WEAPON_APPEARS, TYPE_PROC_REF(/datum, signal_qdel), override = TRUE)
|
|
return ..()
|
|
|
|
/obj/item/slapper/parry/Destroy()
|
|
if(isliving(loc))
|
|
var/mob/owner = loc
|
|
UnregisterSignal(owner, COMSIG_MOB_WILLINGLY_DROP)
|
|
UnregisterSignal(owner, COMSIG_MOB_WEAPON_APPEARS)
|
|
return ..()
|
|
|
|
/obj/item/slapper/parry/attack__legacy__attackchain(mob/M, mob/living/carbon/human/user)
|
|
if(isliving(M))
|
|
var/mob/living/creature = M
|
|
SEND_SOUND(creature, sound('sound/weapons/flash_ring.ogg'))
|
|
creature.Confused(10 SECONDS) //SMACK CAM
|
|
creature.EyeBlind(2 SECONDS) //OH GOD MY EARS ARE RINGING
|
|
creature.Deaf(4 SECONDS) //OH MY HEAD
|
|
return ..()
|
|
|
|
/obj/item/slapper/run_pointed_on_item(mob/pointer_mob, atom/target_atom)
|
|
if(target_atom == src)
|
|
pointer_mob.visible_message("<b>[pointer_mob]</b> raises [pointer_mob.p_their()] hand!")
|
|
return TRUE
|
|
return ..()
|