Skip to content

Commit

Permalink
headless ghost tech
Browse files Browse the repository at this point in the history
  • Loading branch information
Kapu1178 committed Aug 28, 2024
1 parent 1e6d9d0 commit c24729d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 13 deletions.
3 changes: 3 additions & 0 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
var/mob/living/current
var/active = FALSE

/// A copy of a corpse appearance, set when transferring a mind to a brainmob.
var/mutable_appearance/body_appearance

///a list of /datum/memories. assoc type of memory = memory datum. only one type of memory will be stored, new ones of the same type overriding the last.
var/list/memories = list()
///reference to the memory panel tgui
Expand Down
2 changes: 1 addition & 1 deletion code/datums/status_effects/debuffs/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
var/delta = world.time - last_dead_time
var/new_timeofdeath = owner.timeofdeath + delta
owner.timeofdeath = new_timeofdeath
owner.tod = stationtime2text(reference_time=new_timeofdeath)
owner.timeofdeath_as_ingame = stationtime2text(reference_time=new_timeofdeath)
last_dead_time = null
if(owner.stat == DEAD)
last_dead_time = world.time
Expand Down
10 changes: 6 additions & 4 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -786,15 +786,17 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
gas_scan = TRUE

/mob/dead/observer/proc/set_ghost_appearance(mob/living/to_copy)
if(!to_copy || !to_copy.icon)
var/mutable_appearance/appearance = to_copy?.mind?.body_appearance || to_copy

if(!appearance || !appearance.icon)
icon = initial(icon)
icon_state = "ghost"
alpha = 255
overlays.Cut()
else
icon = to_copy.icon
icon_state = to_copy.icon_state
overlays = to_copy.overlays
icon = appearance.icon
icon_state = appearance.icon_state
overlays = appearance.overlays
alpha = 127

/mob/dead/observer/canUseTopic(atom/movable/target, flags)
Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/living/brain/brain_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,25 @@
return
if(!L.mind)
return

brainmob = new(src)
brainmob.set_real_name(L.real_name)
brainmob.timeofhostdeath = L.timeofdeath
brainmob.suiciding = suicided

if(L.has_dna())
var/mob/living/carbon/C = L
if(!brainmob.stored_dna)
brainmob.stored_dna = new /datum/dna/stored(brainmob)
C.dna.copy_dna(brainmob.stored_dna)
if(HAS_TRAIT(L, TRAIT_BADDNA))
LAZYSET(brainmob.status_traits, TRAIT_BADDNA, L.status_traits[TRAIT_BADDNA])

if(L.mind && L.mind.current)
if(!QDELETED(L))
L.mind.body_appearance = L.appearance
L.mind.transfer_to(brainmob)

to_chat(brainmob, span_notice("You feel slightly disoriented. That's normal when you're just a brain."))

/obj/item/organ/brain/attackby(obj/item/O, mob/user, params)
Expand Down
8 changes: 5 additions & 3 deletions code/modules/mob/living/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

died_as_name = name
timeofdeath = world.time
tod = stationtime2text()
timeofdeath_as_ingame = stationtime2text()

// tgchat displays doc strings with formatting, so we do stupid shit instead
var/list/death_message = list(
Expand All @@ -97,8 +97,10 @@

var/turf/T = get_turf(src)

if(mind && mind.name && mind.active && !istype(T.loc, /area/centcom/ctf))
deadchat_broadcast(" has died at <b>[get_area_name(T)]</b>.", "<b>[mind.name]</b>", follow_target = src, turf_target = T, message_type=DEADCHAT_DEATHRATTLE)
if(mind && mind.name && mind.active)
if(!istype(T.loc, /area/centcom/ctf))
deadchat_broadcast(" has died at <b>[get_area_name(T)]</b>.", "<b>[mind.name]</b>", follow_target = src, turf_target = T, message_type=DEADCHAT_DEATHRATTLE)

if(SSlag_switch.measures[DISABLE_DEAD_KEYLOOP] && !client?.holder)
to_chat(src, span_deadsay(span_big("Observer freelook is disabled.\nPlease use Orbit, Teleport, and Jump to look around.")))
ghostize(TRUE)
Expand Down
7 changes: 4 additions & 3 deletions code/modules/mob/living/living_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ DEFINE_INTERACTABLE(/mob/living)
var/hallucination = 0 ///Directly affects how long a mob will hallucinate for

var/last_special = 0 ///Used by the resist verb, likely used to prevent players from bypassing next_move by logging in/out.
/// Time of death as world.time
var/timeofdeath = 0

/// Helper vars for quick access to firestacks, these should be updated every time firestacks are adjusted
var/on_fire = FALSE
var/fire_stacks = 0

/**
/** mind.mob_appearance = appearance
* Allows mobs to move through dense areas without restriction. For instance, in space or out of holder objects.
*
* FALSE is off, [INCORPOREAL_MOVE_BASIC] is normal, [INCORPOREAL_MOVE_SHADOW] is for ninjas
Expand All @@ -90,8 +91,8 @@ DEFINE_INTERACTABLE(/mob/living)

var/cameraFollow = null

/// Time of death
var/tod = null
/// Time of death in the in-game time format
var/timeofdeath_as_ingame = null

var/limb_destroyer = 0 //1 Sets AI behavior that allows mobs to target and dismember limbs with their basic attack.

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/status_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@
REMOVE_TRAIT(src, TRAIT_FAKEDEATH, source)
REMOVE_TRAIT(src, TRAIT_DEATHCOMA, source)
if(stat != DEAD)
tod = null
timeofdeath_as_ingame = null

/// Induces fake death on a living mob.
/mob/living/proc/fakedeath(source, silent = FALSE)
Expand All @@ -667,7 +667,7 @@
emote("deathgasp")
ADD_TRAIT(src, TRAIT_FAKEDEATH, source)
ADD_TRAIT(src, TRAIT_DEATHCOMA, source)
tod = stationtime2text()
timeofdeath_as_ingame = stationtime2text()


///Unignores all slowdowns that lack the IGNORE_NOSLOW flag.
Expand Down

0 comments on commit c24729d

Please sign in to comment.