Skip to content

Commit

Permalink
epic gravedigger update
Browse files Browse the repository at this point in the history
  • Loading branch information
ChungusGamer666 committed Apr 19, 2024
1 parent c96f5c6 commit 22ba1f1
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 74 deletions.
2 changes: 1 addition & 1 deletion code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
qdel(M)
return

M.key = key
client.verbs -= /client/proc/descend
M.key = key
// M.Login() //wat
return

Expand Down
136 changes: 66 additions & 70 deletions code/modules/mob/living/carbon/spirit/spirit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,86 +148,82 @@

///Get the underworld spirit associated with this mob (from the mind)
/mob/proc/get_spirit()
if(!mind)
var/mind_key = key || mind?.key
if(!mind_key)
return
for(var/mob/living/carbon/spirit/spirit in GLOB.carbon_list)
if(spirit.key == mind.key)
if((spirit.key == mind_key) || (spirit.mind?.key == mind_key))
return spirit

/proc/spirit_peace(atom/movable/coffin, mob/user, deep = TRUE)
/mob/living/carbon/spirit/get_spirit()
return src

/mob/proc/pacifyme(mob/user)
return pacify_corpse(src, user)

/// Proc that will search inside a given atom for any corpses, and send the associated ghost to the lobby if possible
/proc/pacify_coffin(atom/movable/coffin, mob/user, deep = TRUE, give_pq = TRUE)
if(!coffin)
return
return FALSE
var/success = FALSE
if(isliving(coffin))
success ||= pacify_corpse(coffin, user)
for(var/mob/living/corpse in coffin)
if(corpse.stat != DEAD)
continue
if(ishuman(corpse) && !HAS_TRAIT(corpse, TRAIT_BURIED_COIN_GIVEN))
var/mob/living/carbon/human/human_corpse = corpse
if(istype(human_corpse.mouth, /obj/item/roguecoin))
var/obj/item/roguecoin/coin = human_corpse.mouth
if(coin.quantity >= 1) // stuffing their mouth full of a fuck ton of coins wont do shit
ADD_TRAIT(human_corpse, TRAIT_BURIED_COIN_GIVEN, TRAIT_GENERIC)
for(var/obj/effect/landmark/underworld/coin_spawn in GLOB.landmarks_list)
var/turf/fallen = get_turf(coin_spawn)
fallen = locate(fallen.x + rand(-3, 3), fallen.y + rand(-3, 3), fallen.z)
new /obj/item/underworld/coin/notracking(fallen)
fallen.visible_message("<span class='warning'>A coin falls from above!</span>")
if(user?.ckey)
adjust_playerquality(0.25, user.ckey)
qdel(human_corpse.mouth)
human_corpse.update_inv_mouth()
break
corpse.mind?.remove_antag_datum(/datum/antagonist/zombie)
var/mob/dead/observer/ghost
//Try to find a lost ghost if there is no client
if(!corpse.client)
ghost = corpse.get_ghost()
//Try to find underworld spirit, if there is no ghost
if(!ghost)
var/mob/living/carbon/spirit/spirit = corpse.get_spirit()
if(spirit)
ghost = spirit.ghostize(force_respawn = TRUE)
qdel(spirit)
else
ghost = corpse.ghostize(force_respawn = TRUE)
if(ghost)
testing("bursuccess ([brainmob.mind?.key || "no key")
var/user_acknowledgement = user ? user.real_name : "a mysterious force"
to_chat(ghost, "<span class='rose'>My soul finds peace buried in creation, thanks to [user_acknowledgement].</span>")
ghost.returntolobby(RESPAWNTIME*-1)
success = TRUE
else
testing("burfail ([corpse.mind?.key || "no key"])")
success ||= pacify_corpse(corpse, user)
for(var/obj/item/bodypart/head/head in coffin)
if(!head.brainmob)
continue
var/mob/living/brain/brainmob = head.brainmob
if(brainmob.stat != DEAD)
continue
var/mob/dead/observer/ghost
//Try to find a lost ghost if there is no client
if(!brainmob.client)
ghost = brainmob.get_ghost()
//Try to find underworld spirit, if there is no lost ghost
if(!ghost)
var/mob/living/carbon/spirit/lost_soul = brainmob.get_spirit()
if(lost_soul)
ghost = brainmob.ghostize(force_respawn = TRUE)
qdel(lost_soul)
else
ghost = brainmob.ghostize(force_respawn = TRUE)
if(brainmob)
testing("headbursuccess ([brainmob.mind?.key || "no key"])")
var/user_acknowledgement = user ? user.real_name : "a mysterious force"
to_chat(ghost, "<span class='rose'>My soul finds peace buried in creation, thanks to [user_acknowledgement].</span>")
ghost.returntolobby(RESPAWNTIME*-1)
success = TRUE
else
testing("headburfail ([brainmob.mind?.key || "no key"])")
if(success && user?.ckey)
adjust_playerquality(0.25, user.ckey)
//if this is a deep search, we will also search the contents of the coffin to do peace
success ||= pacify_corpse(head.brainmob, user)
//if this is a deep search, we will also search the contents of the coffin to pacify (EXCEPT MOBS, SINCE WE HANDLED THOSE)
if(deep)
for(var/atom/movable/stuffing in coffin)
success ||= spirit_peace(stuffing, user, deep)
if(isliving(stuffing) || istype(stuffing, /obj/item/bodypart/head))
continue
success ||= pacify_coffin(stuffing, user, deep, give_pq = FALSE)
if(success && give_pq && user?.ckey)
adjust_playerquality(0.25, user.ckey)
return success

/// Proc that sends the client associated with a given corpse to the lobby, if possible
/proc/pacify_corpse(mob/living/corpse, mob/user)
if(corpse.stat != DEAD)
return FALSE
if(ishuman(corpse) && !HAS_TRAIT(corpse, TRAIT_BURIED_COIN_GIVEN))
var/mob/living/carbon/human/human_corpse = corpse
if(istype(human_corpse.mouth, /obj/item/roguecoin))
var/obj/item/roguecoin/coin = human_corpse.mouth
if(coin.quantity >= 1) // stuffing their mouth full of a fuck ton of coins wont do shit
ADD_TRAIT(human_corpse, TRAIT_BURIED_COIN_GIVEN, TRAIT_GENERIC)
for(var/obj/effect/landmark/underworld/coin_spawn in GLOB.landmarks_list)
var/turf/fallen = get_turf(coin_spawn)
fallen = locate(fallen.x + rand(-3, 3), fallen.y + rand(-3, 3), fallen.z)
new /obj/item/underworld/coin/notracking(fallen)
fallen.visible_message("<span class='warning'>A coin falls from above!</span>")
if(user?.ckey)
adjust_playerquality(0.25, user.ckey)
qdel(human_corpse.mouth)
human_corpse.update_inv_mouth()
break
corpse.mind?.remove_antag_datum(/datum/antagonist/zombie)
var/mob/dead/observer/ghost
//Try to find a lost ghost if there is no client
if(!corpse.client)
ghost = corpse.get_ghost()
//Try to find underworld spirit, if there is no ghost
if(!ghost)
var/mob/living/carbon/spirit/spirit = corpse.get_spirit()
if(spirit)
ghost = spirit.ghostize(force_respawn = TRUE)
qdel(spirit)
else
ghost = corpse.ghostize(force_respawn = TRUE)

if(ghost)
testing("pacify_corpse success ([brainmob.mind?.key || "no key"])")
var/user_acknowledgement = user ? user.real_name : "a mysterious force"
to_chat(ghost, "<span class='rose'>My soul finds peace buried in creation, thanks to [user_acknowledgement].</span>")
ghost.returntolobby(RESPAWNTIME*-1)
return TRUE

testing("pacify_corpse fail ([corpse.mind?.key || "no key"])")
return FALSE
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@
/obj/structure/gravemarker/OnCrafted(dir, user)
icon_state = "gravemarker[rand(1,3)]"
for(var/obj/structure/closet/dirthole/hole in loc)
spirit_peace(hole, user)
pacify_coffin(hole, user)
return ..()
4 changes: 2 additions & 2 deletions code/modules/spells/roguetown/cleric.dm
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@
. = ..()
var/success = FALSE
for(var/obj/structure/closet/crate/coffin/coffin in view(1))
success = spirit_peace(coffin, user)
success = pacify_coffin(coffin, user)
if(success)
user.visible_message("My funeral rites have been performed on [coffin]!", "[user] consecrates [coffin]!")
return
for(var/obj/structure/closet/dirthole/hole in view(1))
success = spirit_peace(hole, user)
success = pacify_coffin(hole, user)
if(success)
user.visible_message("My funeral rites have been performed on [hole]!", "[user] consecrates [hole]!")
return
Expand Down

0 comments on commit 22ba1f1

Please sign in to comment.