Skip to content

Commit

Permalink
fix some minor runtimes with bloodsuckers (#3534)
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy authored Sep 25, 2024
1 parent 935d6c4 commit 932625e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion code/datums/actions/cooldown_action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
return COMPONENT_HOSTILE_NO_ATTACK

/datum/action/cooldown/process()
if(!owner || (next_use_time - world.time) <= 0)
if(QDELETED(owner) || (next_use_time - world.time) <= 0)
build_all_button_icons(UPDATE_BUTTON_STATUS)
STOP_PROCESSING(SSfastprocess, src)
return
Expand Down
4 changes: 2 additions & 2 deletions monkestation/code/modules/bloodsuckers/powers/_base_power.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

///Checks if the Power is available to use.
/datum/action/cooldown/bloodsucker/proc/can_use(mob/living/carbon/user, trigger_flags)
if(!owner)
if(QDELETED(owner))
return FALSE
if(!isliving(user))
return FALSE
Expand Down Expand Up @@ -218,7 +218,7 @@

/// Checks to make sure this power can stay active
/datum/action/cooldown/bloodsucker/proc/ContinueActive(mob/living/user, mob/living/target)
if(!user)
if(QDELETED(user))
return FALSE
if(!constant_bloodcost > 0 || bloodsuckerdatum_power.bloodsucker_blood_volume > 0)
return TRUE
Expand Down
2 changes: 1 addition & 1 deletion monkestation/code/modules/bloodsuckers/powers/cloak.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
. = ..()
if(!.)
return FALSE
for(var/mob/living/watcher in view(9, owner) - owner)
for(var/mob/living/watcher in viewers(9, owner) - owner)
if(watcher.stat == DEAD || QDELETED(watcher.client))
continue
if(IS_BLOODSUCKER(watcher) || IS_VASSAL(watcher))
Expand Down
16 changes: 5 additions & 11 deletions monkestation/code/modules/bloodsuckers/powers/go_home.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
// If we aren't in the dark, anyone watching us will cause us to drop out stuff
if(!QDELETED(current_turf?.lighting_object) && current_turf.get_lumcount() >= 0.2)
for(var/mob/living/watchers in viewers(world.view, get_turf(owner)) - owner)
if(QDELETED(watchers.client))
if(QDELETED(watchers.client) || watchers.stat != CONSCIOUS)
continue
if(watchers.has_unlimited_silicon_privilege)
continue
Expand All @@ -96,17 +96,11 @@
drop_item = TRUE
break
// Drop all necessary items (handcuffs, legcuffs, items if seen)
if(user.handcuffed)
var/obj/item/handcuffs = user.handcuffed
user.dropItemToGround(handcuffs)
if(user.legcuffed)
var/obj/item/legcuffs = user.legcuffed
user.dropItemToGround(legcuffs)
user.uncuff()
if(drop_item)
for(var/obj/item/literally_everything in owner)
owner.dropItemToGround(literally_everything, TRUE)
user.unequip_everything()

playsound(current_turf, 'sound/magic/summon_karp.ogg', 60, 1)
playsound(current_turf, 'sound/magic/summon_karp.ogg', vol = 60, vary = TRUE)

var/datum/effect_system/steam_spread/bloodsucker/puff = new /datum/effect_system/steam_spread/bloodsucker()
puff.set_up(3, 0, current_turf)
Expand All @@ -120,7 +114,7 @@
do_teleport(owner, bloodsuckerdatum_power.coffin, no_effects = TRUE, forced = TRUE, channel = TELEPORT_CHANNEL_QUANTUM)
bloodsuckerdatum_power.coffin.close(owner)
bloodsuckerdatum_power.coffin.take_contents()
playsound(bloodsuckerdatum_power.coffin.loc, bloodsuckerdatum_power.coffin.close_sound, 15, 1, -3)
playsound(bloodsuckerdatum_power.coffin.loc, bloodsuckerdatum_power.coffin.close_sound, vol = 15, vary = TRUE, extrarange = -3)

DeactivatePower()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
var/datum/antagonist/vassal/vassaldatum = owner.mind.has_antag_datum(/datum/antagonist/vassal)

owner.balloon_alert(owner, "you call out for your master!")
to_chat(vassaldatum.master.owner, "<span class='userdanger'>[owner], your loyal Vassal, is desperately calling for aid at [target_area]!</span>")
to_chat(vassaldatum.master.owner, span_userdanger("[owner], your loyal Vassal, is desperately calling for aid at [target_area]!"))

var/mob/living/user = owner
user.adjustBruteLoss(10)
user.take_overall_damage(brute = 10)
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,28 @@
. = ..()
if(!.)
return

if(!active)
return
var/mob/living/carbon/user = owner
var/datum/antagonist/vassal/vassaldatum = IS_VASSAL(user)
vassaldatum.master.AddBloodVolume(-1)
user.set_timed_status_effect(5 SECONDS, /datum/status_effect/jitter, only_if_higher = TRUE)
user.stamina.adjust(-bloodcost * 1.1)
user.adjustBruteLoss(-2.5)
user.adjustToxLoss(-2, forced = TRUE)
user.heal_overall_damage(brute = 2.5, updating_health = FALSE)
user.adjustToxLoss(-2, updating_health = FALSE, forced = TRUE)
// Plasmamen won't lose blood, they don't have any, so they don't heal from Burn.
if(!HAS_TRAIT(user, TRAIT_NOBLOOD))
user.blood_volume -= bloodcost
user.adjustFireLoss(-1.5)
user.adjustFireLoss(-1.5, updating_health = FALSE)
user.updatehealth() // only update health once after we've healed everything we might've
// Stop Bleeding
if(istype(user) && user.is_bleeding())
for(var/obj/item/bodypart/part in user.bodyparts)
part.generic_bleedstacks--

/datum/action/cooldown/bloodsucker/recuperate/ContinueActive(mob/living/user, mob/living/target)
if(QDELETED(user))
return FALSE
if(user.stat >= DEAD)
return FALSE
if(user.incapacitated())
Expand All @@ -64,5 +66,5 @@
return TRUE

/datum/action/cooldown/bloodsucker/recuperate/DeactivatePower()
owner.balloon_alert(owner, "recuperate turned off.")
owner?.balloon_alert(owner, "recuperate turned off.")
return ..()

0 comments on commit 932625e

Please sign in to comment.