componentization part 1: "The flawed theorical code"

This commit is contained in:
Ghommie
2019-06-10 22:37:38 +02:00
parent 17febdd07c
commit 3cbe9cf6b0
55 changed files with 288 additions and 209 deletions
@@ -285,7 +285,7 @@
else
to_chat(src, "<span class='notice'>Teleporting failed. Ahelp an admin please</span>")
stack_trace("There's no freaking observer landmark available on this map or you're making observers before the map is initialised")
observer.key = key
transfer_key(observer, FALSE)
observer.client = client
observer.set_ghost_appearance()
if(observer.client && observer.client.prefs)
+12 -12
View File
@@ -260,16 +260,16 @@ Transfer_mind is there to check if mob is being deleted/not going to have a body
Works together with spawning an observer, noted above.
*/
/mob/proc/ghostize(can_reenter_corpse = 1)
if(key)
if(!cmptext(copytext(key,1,2),"@")) // Skip aghosts.
stop_sound_channel(CHANNEL_HEARTBEAT) //Stop heartbeat sounds because You Are A Ghost Now
var/mob/dead/observer/ghost = new(src) // Transfer safety to observer spawning proc.
SStgui.on_transfer(src, ghost) // Transfer NanoUIs.
ghost.can_reenter_corpse = can_reenter_corpse
ghost.can_reenter_round = (can_reenter_corpse && !suiciding)
ghost.key = key
return ghost
/mob/proc/ghostize(can_reenter_corpse = TRUE, send_the_signal = TRUE)
if(!key || cmptext(copytext(key,1,2),"@") || (send_the_signal && SEND_SIGNAL(src, COMSIG_MOB_GHOSTIZE, can_reenter_corpse) & COMPONENT_BLOCK_GHOSTING))
return //mob has no key, is an aghost or some component hijack.
stop_sound_channel(CHANNEL_HEARTBEAT) //Stop heartbeat sounds because You Are A Ghost Now
var/mob/dead/observer/ghost = new(src) // Transfer safety to observer spawning proc.
SStgui.on_transfer(src, ghost) // Transfer NanoUIs.
ghost.can_reenter_corpse = can_reenter_corpse
ghost.can_reenter_round = (can_reenter_corpse && !suiciding)
transfer_key(ghost, FALSE)
return ghost
/*
This is the proc mobs get to turn into a ghost. Forked from ghostize due to compatibility issues.
@@ -348,7 +348,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
return
client.change_view(CONFIG_GET(string/default_view))
SStgui.on_transfer(src, mind.current) // Transfer NanoUIs.
mind.current.key = key
transfer_key(mind.current, FALSE)
return 1
/mob/dead/observer/proc/notify_cloning(var/message, var/sound, var/atom/source, flashwindow = TRUE)
@@ -631,7 +631,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
to_chat(src, "<span class='warning'>Someone has taken this body while you were choosing!</span>")
return 0
target.key = key
transfer_key(target, FALSE)
target.faction = list("neutral")
return 1
+2 -2
View File
@@ -34,7 +34,7 @@
if(brainmob.mind)
brainmob.mind.transfer_to(C)
else
C.key = brainmob.key
brainmob.transfer_key(C)
QDEL_NULL(brainmob)
@@ -64,7 +64,7 @@
name = "[L.name]'s brain"
if(brainmob)
return
if(!L.mind)
return
brainmob = new(src)
@@ -86,7 +86,7 @@
var/atom/xeno_loc = get_turf(owner)
var/mob/living/carbon/alien/larva/new_xeno = new(xeno_loc)
new_xeno.key = ghost.key
ghost.transfer_key(new_xeno, FALSE)
SEND_SOUND(new_xeno, sound('sound/voice/hiss5.ogg',0,0,0,100)) //To get the player's attention
new_xeno.canmove = 0 //so we don't move during the bursting animation
new_xeno.notransform = 1
+1 -1
View File
@@ -878,7 +878,7 @@
if(mind)
mind.transfer_to(new_mob)
else
new_mob.key = key
transfer_key(new_mob)
for(var/para in hasparasites())
var/mob/living/simple_animal/hostile/guardian/G = para
+1 -1
View File
@@ -86,7 +86,7 @@
var/datum/action/innate/deploy_last_shell/redeploy_action = new
var/chnotify = 0
var/multicam_on = FALSE
var/obj/screen/movable/pic_in_pic/ai/master_multicam
var/list/multicam_screens = list()
+1 -1
View File
@@ -192,7 +192,7 @@
/mob/proc/makePAI(delold)
var/obj/item/paicard/card = new /obj/item/paicard(get_turf(src))
var/mob/living/silicon/pai/pai = new /mob/living/silicon/pai(card)
pai.key = key
transfer_key(pai)
pai.name = name
card.setPersonality(pai)
if(delold)
@@ -916,7 +916,7 @@ Pass a positive integer as an argument to override a bot's default speed.
if(mind && paicard.pai)
mind.transfer_to(paicard.pai)
else if(paicard.pai)
paicard.pai.key = key
transfer_key(paicard.pai)
else
ghostize(0) // The pAI card that just got ejected was dead.
key = null
@@ -159,7 +159,7 @@
if(mind)
mind.transfer_to(R, 1)
else
R.key = key
transfer_key(R)
qdel(src)
@@ -61,5 +61,5 @@
var/obj/item/new_hat = new hat_type(D)
D.equip_to_slot_or_del(new_hat, SLOT_HEAD)
D.flags_1 |= (flags_1 & ADMIN_SPAWNED_1)
D.key = user.key
user.transfer_key(D, FALSE)
qdel(src)
@@ -426,9 +426,9 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians
to_chat(G, "<span class='holoparasite'>Your user reset you, and your body was taken over by a ghost. Looks like they weren't happy with your performance.</span>")
to_chat(src, "<span class='holoparasite bold'>Your <font color=\"[G.namedatum.colour]\">[G.real_name]</font> has been successfully reset.</span>")
message_admins("[key_name_admin(C)] has taken control of ([key_name_admin(G)])")
G.ghostize(0)
G.ghostize(FALSE, FALSE)
G.setthemename(G.namedatum.theme) //give it a new color, to show it's a new person
G.key = C.key
C.transfer_key(G)
G.reset = 1
switch(G.namedatum.theme)
if("tech")
@@ -90,7 +90,7 @@
if(key)
to_chat(user, "<span class='notice'>Someone else already took this spider.</span>")
return 1
key = user.key
user.transfer_key(src, FALSE)
return 1
//nursemaids - these create webs and eggs
@@ -585,7 +585,7 @@ Difficulty: Very Hard
var/be_helper = alert("Become a Lightgeist? (Warning, You can no longer be cloned!)",,"Yes","No")
if(be_helper == "Yes" && !QDELETED(src) && isobserver(user))
var/mob/living/simple_animal/hostile/lightgeist/W = new /mob/living/simple_animal/hostile/lightgeist(get_turf(loc))
W.key = user.key
user.transfer_key(W, FALSE)
/obj/machinery/anomalous_crystal/helpers/Topic(href, href_list)
@@ -649,7 +649,7 @@ Difficulty: Very Hard
L.heal_overall_damage(heal_power, heal_power)
new /obj/effect/temp_visual/heal(get_turf(target), "#80F5FF")
/mob/living/simple_animal/hostile/lightgeist/ghostize()
/mob/living/simple_animal/hostile/lightgeist/ghostize(can_reenter_corpse = TRUE, send_the_signal = TRUE)
. = ..()
if(.)
death()
@@ -920,7 +920,7 @@
if(mind)
mind.transfer_to(G)
else
G.key = key
transfer_key(G)
..(gibbed)
/mob/living/simple_animal/parrot/Poly/proc/Read_Memory()
@@ -174,7 +174,7 @@
if(src.mind)
src.mind.transfer_to(new_slime)
else
new_slime.key = src.key
transfer_key(new_slime)
qdel(src)
else
to_chat(src, "<i>I am not ready to reproduce yet...</i>")
+4 -1
View File
@@ -436,7 +436,10 @@
// M.Login() //wat
return
/mob/proc/transfer_key(mob/new_mob, send_signal = TRUE)
if(send_signal)
SEND_SIGNAL(src, COMSIG_MOB_KEY_CHANGE, new_mob)
new_mob.key = key
/mob/verb/cancel_camera()
set name = "Cancel Camera View"
+2 -2
View File
@@ -429,8 +429,8 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
var/mob/dead/observer/C = pick(candidates)
to_chat(M, "Your mob has been taken over by a ghost!")
message_admins("[key_name_admin(C)] has taken control of ([key_name_admin(M)])")
M.ghostize(0)
M.key = C.key
M.ghostize(FALSE, FALSE)
C.transfer_key(M, FALSE)
return TRUE
else
to_chat(M, "There were no ghosts willing to take control.")
@@ -53,7 +53,7 @@
if(mind && isliving(M))
mind.transfer_to(M, 1) // second argument to force key move to new mob
else
M.key = key
transfer_key(M)
if(delete_old_mob)
QDEL_IN(src, 1)
+8 -8
View File
@@ -382,7 +382,7 @@
mind.active = FALSE
mind.transfer_to(R)
else if(transfer_after)
R.key = key
transfer_key(R)
R.apply_pref_name("cyborg")
@@ -425,7 +425,7 @@
new_xeno = new /mob/living/carbon/alien/humanoid/drone(loc)
new_xeno.a_intent = INTENT_HARM
new_xeno.key = key
transfer_key(new_xeno)
to_chat(new_xeno, "<B>You are now an alien.</B>")
. = new_xeno
@@ -457,7 +457,7 @@
else
new_slime = new /mob/living/simple_animal/slime(loc)
new_slime.a_intent = INTENT_HARM
new_slime.key = key
transfer_key(new_slime)
to_chat(new_slime, "<B>You are now a slime. Skreee!</B>")
. = new_slime
@@ -465,7 +465,7 @@
/mob/proc/become_overmind(starting_points = 60)
var/mob/camera/blob/B = new /mob/camera/blob(get_turf(src), starting_points)
B.key = key
transfer_key(B)
. = B
qdel(src)
@@ -485,7 +485,7 @@
var/mob/living/simple_animal/pet/dog/corgi/new_corgi = new /mob/living/simple_animal/pet/dog/corgi (loc)
new_corgi.a_intent = INTENT_HARM
new_corgi.key = key
transfer_key(new_corgi)
to_chat(new_corgi, "<B>You are now a Corgi. Yap Yap!</B>")
. = new_corgi
@@ -512,7 +512,7 @@
if(mind)
mind.transfer_to(new_gorilla)
else
new_gorilla.key = key
transfer_key(new_gorilla)
to_chat(new_gorilla, "<B>You are now a gorilla. Ooga ooga!</B>")
. = new_gorilla
qdel(src)
@@ -542,7 +542,7 @@
var/mob/new_mob = new mobpath(src.loc)
new_mob.key = key
transfer_key(new_mob)
new_mob.a_intent = INTENT_HARM
@@ -561,7 +561,7 @@
var/mob/new_mob = new mobpath(src.loc)
new_mob.key = key
transfer_key(new_mob)
new_mob.a_intent = INTENT_HARM
to_chat(new_mob, "You feel more... animalistic")