cmss13-devs / cmss13

Contains the code for CM-SS13
https://cm-ss13.com
GNU Affero General Public License v3.0
94 stars 510 forks source link

Dead king can trample mobs. #6464

Open cm13-issue-bot opened 3 months ago

cm13-issue-bot commented 3 months ago

Testmerges

#6071: '[V] Sorokyne Strata: fixes and changes .' by Venuska1117 at commit 77b1ffb107
#6304: 'STEEL DIVISON (Re-introduces 200 pop locked tank) [CODE BOUNTY]' by Red-byte3D at commit b51bd40abe
#6355: 'ID Mod computer biometrics' by realforest2001 at commit bd4cb15883
#6383: 'Replaces the ARC interior & ARC tweaks' by Zonespace27 at commit 4df6e6ea75
#6363: 'First Drop Protections: Gas and Static Turrets' by Drulikar at commit bb9a7df8e2
#6388: 'gayons' by 567Turtle at commit 4f9151f1ba
#6334: 'Xenomorph Endgame' by Git-Nivrak at commit 25f3f77ada
#6039: 'Project ARES TM Holder (v5)' by realforest2001 at commit 9f4c76c456
#6392: 'Adds in-game bug reports without needing a GitHub account' by vero5123 at commit 9e65823834

Round ID

22638

Description of the bug

When dragged over mobs, dead king can still trample them and deal damage as if it was alive.

What's the difference with what should have happened?

It shouldn't do this.

How do we reproduce this bug?

1) Kill king. 2) Drag it over a mob, even yourself. 3) Get trampled, receive damage, laugh.

Attached logs

N/A

Additional details

vero5123 commented 3 months ago

once it's dead you should maybe unregister this, or just return if it's dead however you wanna do it.@Git-Nivrak

/mob/living/carbon/xenomorph/king/Initialize()
    . = ..()
    AddComponent(/datum/component/footstep, 2 , 35, 11, 4, "alien_footstep_large")
    RegisterSignal(src, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(check_block))

/mob/living/carbon/xenomorph/king/proc/check_block(mob/king, turf/new_loc)
    SIGNAL_HANDLER
    for(var/mob/living/carbon/carbon in new_loc.contents)
        if(isxeno(carbon))
            var/mob/living/carbon/xenomorph/xeno = carbon
            if(xeno.hivenumber == src.hivenumber)
                xeno.KnockDown((5 DECISECONDS) / GLOBAL_STATUS_MULTIPLIER)
            else
                xeno.KnockDown((1 SECONDS) / GLOBAL_STATUS_MULTIPLIER)
        else
            if(carbon.stat != DEAD)
                carbon.apply_armoured_damage(20)
                carbon.KnockDown((1 SECONDS) / GLOBAL_STATUS_MULTIPLIER)

        playsound(src, 'sound/weapons/alien_knockdown.ogg', 25, 1)
vero5123 commented 3 months ago

maybe it also shouldn't play the trample sound if it walks over a dead mob?

vero5123 commented 3 months ago

so like

/mob/living/carbon/xenomorph/king/proc/check_block(mob/king, turf/new_loc)
    SIGNAL_HANDLER
    for(var/mob/living/carbon/carbon in new_loc.contents)
                if(carbon.is_dead())
                        continue
        if(isxeno(carbon))
            var/mob/living/carbon/xenomorph/xeno = carbon
            if(xeno.hivenumber == hivenumber)
                xeno.KnockDown((5 DECISECONDS) / GLOBAL_STATUS_MULTIPLIER)
            else
                xeno.KnockDown((1 SECONDS) / GLOBAL_STATUS_MULTIPLIER)
        else
            carbon.apply_armoured_damage(20)
            carbon.KnockDown((1 SECONDS) / GLOBAL_STATUS_MULTIPLIER)

        playsound(src, 'sound/weapons/alien_knockdown.ogg', 25, 1)