From ebef6272b92067a05d474c75a2a6621161d87499 Mon Sep 17 00:00:00 2001 From: Sebastian Broberg Date: Thu, 24 Dec 2015 23:02:37 +0100 Subject: [PATCH 1/4] Fixes #11711 Should fix it. --- code/modules/mob/living/simple_animal/constructs/soulstone.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/constructs/soulstone.dm b/code/modules/mob/living/simple_animal/constructs/soulstone.dm index 5859969d03b..d5c7ad1149f 100644 --- a/code/modules/mob/living/simple_animal/constructs/soulstone.dm +++ b/code/modules/mob/living/simple_animal/constructs/soulstone.dm @@ -113,7 +113,7 @@ if(C.imprinted != "empty") U << "\red Capture failed!: \black The soul stone has already been imprinted with [C.imprinted]'s mind!" else - if ((T.health + T.halloss) > config.health_threshold_crit) + if ((T.health + T.halloss) > config.health_threshold_crit || T.stat == DEAD) U << "\red Capture failed!: \black Kill or maim the victim first!" else if(T.client == null) From b000ca4eb76de7f456c8b0bf52ed0257db43ed69 Mon Sep 17 00:00:00 2001 From: Sebastian Broberg Date: Fri, 25 Dec 2015 11:30:33 +0100 Subject: [PATCH 2/4] Boop, logic escaped me also refractor this shit someone. --- code/modules/mob/living/simple_animal/constructs/soulstone.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/constructs/soulstone.dm b/code/modules/mob/living/simple_animal/constructs/soulstone.dm index d5c7ad1149f..1007d89d99c 100644 --- a/code/modules/mob/living/simple_animal/constructs/soulstone.dm +++ b/code/modules/mob/living/simple_animal/constructs/soulstone.dm @@ -113,7 +113,7 @@ if(C.imprinted != "empty") U << "\red Capture failed!: \black The soul stone has already been imprinted with [C.imprinted]'s mind!" else - if ((T.health + T.halloss) > config.health_threshold_crit || T.stat == DEAD) + if ((T.health + T.halloss) > config.health_threshold_crit && T.stat != DEAD) U << "\red Capture failed!: \black Kill or maim the victim first!" else if(T.client == null) From 370529bc428a26be325ef7230126d614ef6de7bb Mon Sep 17 00:00:00 2001 From: Sebastian Broberg Date: Fri, 25 Dec 2015 13:04:13 +0100 Subject: [PATCH 3/4] Refractored soulstone.dm Split the various functions of the proc into multiple procs Moved the transfer_soul proc under the soulstone object. --- .../simple_animal/constructs/soulstone.dm | 323 +++++++++--------- .../modules/mob/living/simple_animal/shade.dm | 3 +- 2 files changed, 165 insertions(+), 161 deletions(-) diff --git a/code/modules/mob/living/simple_animal/constructs/soulstone.dm b/code/modules/mob/living/simple_animal/constructs/soulstone.dm index 1007d89d99c..734c97e4d96 100644 --- a/code/modules/mob/living/simple_animal/constructs/soulstone.dm +++ b/code/modules/mob/living/simple_animal/constructs/soulstone.dm @@ -14,74 +14,68 @@ //////////////////////////////Capturing//////////////////////////////////////////////////////// - attack(mob/living/carbon/human/M as mob, mob/user as mob) - if(!istype(M, /mob/living/carbon/human))//If target is not a human. - return ..() - if(istype(M, /mob/living/carbon/human/dummy)) - return..() +/obj/item/device/soulstone/attack(mob/living/carbon/human/M as mob, mob/user as mob) + if(!istype(M, /mob/living/carbon/human))//If target is not a human. + return ..() + if(istype(M, /mob/living/carbon/human/dummy)) + return..() - if(M.has_brain_worms()) //Borer stuff - RR - user << "This being is corrupted by an alien intelligence and cannot be soul trapped." - return..() + if(M.has_brain_worms()) //Borer stuff - RR + user << "This being is corrupted by an alien intelligence and cannot be soul trapped." + return..() - M.attack_log += text("\[[time_stamp()]\] Has had their soul captured with [src.name] by [user.name] ([user.ckey])") - user.attack_log += text("\[[time_stamp()]\] Used the [src.name] to capture the soul of [M.name] ([M.ckey])") - msg_admin_attack("[user.name] ([user.ckey]) used the [src.name] to capture the soul of [M.name] ([M.ckey]) (JMP)") + M.attack_log += text("\[[time_stamp()]\] Has had their soul captured with [src.name] by [user.name] ([user.ckey])") + user.attack_log += text("\[[time_stamp()]\] Used the [src.name] to capture the soul of [M.name] ([M.ckey])") + msg_admin_attack("[user.name] ([user.ckey]) used the [src.name] to capture the soul of [M.name] ([M.ckey]) (JMP)") - transfer_soul("VICTIM", M, user) - return + transfer_soul("VICTIM", M, user) + return - /*attack(mob/living/simple_animal/shade/M as mob, mob/user as mob)//APPARENTLY THEY NEED THEIR OWN SPECIAL SNOWFLAKE CODE IN THE LIVING ANIMAL DEFINES - if(!istype(M, /mob/living/simple_animal/shade))//If target is not a shade - return ..() - user.attack_log += text("\[[time_stamp()]\] Used the [src.name] to capture the soul of [M.name] ([M.ckey])") - transfer_soul("SHADE", M, user) - return*/ ///////////////////Options for using captured souls/////////////////////////////////////// - attack_self(mob/user) - if (!in_range(src, user)) - return - user.set_machine(src) - var/dat = "Soul Stone
" - for(var/mob/living/simple_animal/shade/A in src) - dat += "Captured Soul: [A.name]
" - dat += {"Summon Shade"} - dat += "
" - dat += {" Close"} - user << browse(dat, "window=aicard") - onclose(user, "aicard") +/obj/item/device/soulstone/attack_self(mob/user) + if (!in_range(src, user)) + return + user.set_machine(src) + var/dat = "Soul Stone
" + for(var/mob/living/simple_animal/shade/A in src) + dat += "Captured Soul: [A.name]
" + dat += {"Summon Shade"} + dat += "
" + dat += {" Close"} + user << browse(dat, "window=aicard") + onclose(user, "aicard") + return + + + + +/obj/item/device/soulstone/Topic(href, href_list) + var/mob/U = usr + if (!in_range(src, U)||U.machine!=src) + U << browse(null, "window=aicard") + U.unset_machine() return + add_fingerprint(U) + U.set_machine(src) - - - Topic(href, href_list) - var/mob/U = usr - if (!in_range(src, U)||U.machine!=src) + switch(href_list["choice"])//Now we switch based on choice. + if ("Close") U << browse(null, "window=aicard") U.unset_machine() return - add_fingerprint(U) - U.set_machine(src) - - switch(href_list["choice"])//Now we switch based on choice. - if ("Close") - U << browse(null, "window=aicard") - U.unset_machine() - return - - if ("Summon") - for(var/mob/living/simple_animal/shade/A in src) - A.status_flags &= ~GODMODE - A.canmove = 1 - A << "You have been released from your prison, but you are still bound to [U.name]'s will. Help them suceed in their goals at all costs." - A.loc = U.loc - A.cancel_camera() - src.icon_state = "soulstone" - attack_self(U) + if ("Summon") + for(var/mob/living/simple_animal/shade/A in src) + A.status_flags &= ~GODMODE + A.canmove = 1 + A << "You have been released from your prison, but you are still bound to [U.name]'s will. Help them suceed in their goals at all costs." + A.loc = U.loc + A.cancel_camera() + src.icon_state = "soulstone" + attack_self(U) ///////////////////////////Transferring to constructs///////////////////////////////////////////////////// /obj/structure/constructshell @@ -99,118 +93,127 @@ /obj/structure/constructshell/attackby(obj/item/O as obj, mob/user as mob) if(istype(O, /obj/item/device/soulstone)) - O.transfer_soul("CONSTRUCT",src,user) + var/obj/item/device/soulstone/S = O; + S.transfer_soul("CONSTRUCT",src,user) ////////////////////////////Proc for moving soul in and out off stone////////////////////////////////////// +/obj/item/device/soulstone/proc/transfer_human(var/mob/living/carbon/human/T,var/mob/U) + if(!istype(T)) + return; + if(src.imprinted != "empty") + U << "\red Capture failed!: \black The soul stone has already been imprinted with [src.imprinted]'s mind!" + return + if ((T.health + T.halloss) > config.health_threshold_crit && T.stat != DEAD) + U << "\red Capture failed!: \black Kill or maim the victim first!" + return + if(T.client == null) + U << "\red Capture failed!: \black The soul has already fled it's mortal frame." + return + if(src.contents.len) + U << "\red Capture failed!: \black The soul stone is full! Use or free an existing soul to make room." + return + + for(var/obj/item/W in T) + T.drop_from_inventory(W) + + new /obj/effect/decal/remains/human(T.loc) //Spawns a skeleton + T.invisibility = 101 + + var/atom/movable/overlay/animation = new /atom/movable/overlay( T.loc ) + animation.icon_state = "blank" + animation.icon = 'icons/mob/mob.dmi' + animation.master = T + flick("dust-h", animation) + qdel(animation) + + var/mob/living/simple_animal/shade/S = new /mob/living/simple_animal/shade( T.loc ) + S.loc = src //put shade in stone + S.status_flags |= GODMODE //So they won't die inside the stone somehow + S.canmove = 0//Can't move out of the soul stone + S.name = "Shade of [T.real_name]" + S.real_name = "Shade of [T.real_name]" + S.icon = T.icon + S.icon_state = T.icon_state + S.overlays = T.overlays + S.color = rgb(254,0,0) + S.alpha = 127 + if (T.client) + T.client.mob = S + S.cancel_camera() -/obj/item/proc/transfer_soul(var/choice as text, var/target, var/mob/U as mob). + src.icon_state = "soulstone2" + src.name = "Soul Stone: [S.real_name]" + S << "Your soul has been captured! You are now bound to [U.name]'s will, help them suceed in their goals at all costs." + U << "\blue Capture successful!: \black [T.real_name]'s soul has been ripped from their body and stored within the soul stone." + U << "The soulstone has been imprinted with [S.real_name]'s mind, it will no longer react to other souls." + src.imprinted = "[S.name]" + qdel(T) + +/obj/item/device/soulstone/proc/transfer_shade(var/mob/living/simple_animal/shade/T,var/mob/U) + if(!istype(T)) + return; + if (T.stat == DEAD) + U << "\red Capture failed!: \black The shade has already been banished!" + return + if(src.contents.len) + U << "\red Capture failed!: \black The soul stone is full! Use or free an existing soul to make room." + return + if(T.name != src.imprinted) + U << "\red Capture failed!: \black The soul stone has already been imprinted with [src.imprinted]'s mind!" + return + + T.loc = src //put shade in stone + T.status_flags |= GODMODE + T.canmove = 0 + T.health = T.maxHealth + src.icon_state = "soulstone2" + + T << "Your soul has been recaptured by the soul stone, its arcane energies are reknitting your ethereal form" + U << "\blue Capture successful!: \black [T.name]'s has been recaptured and stored within the soul stone." +/obj/item/device/soulstone/proc/transfer_construct(var/obj/structure/constructshell/T,var/mob/U) + var/mob/living/simple_animal/shade/A = locate() in src + if(!A) + U << "\red Creation failed!: \black The soul stone is empty! Go kill someone!" + return; + var/construct_class = alert(U, "Please choose which type of construct you wish to create.",,"Juggernaut","Wraith","Artificer") + switch(construct_class) + if("Juggernaut") + var/mob/living/simple_animal/construct/armoured/Z = new /mob/living/simple_animal/construct/armoured (get_turf(T.loc)) + Z.key = A.key + if(iscultist(U)) + cult.add_antagonist(Z.mind) + qdel(T) + Z << "You are playing a Juggernaut. Though slow, you can withstand extreme punishment, and rip apart enemies and walls alike." + Z << "You are still bound to serve your creator, follow their orders and help them complete their goals at all costs." + Z.cancel_camera() + qdel(src) + if("Wraith") + var/mob/living/simple_animal/construct/wraith/Z = new /mob/living/simple_animal/construct/wraith (get_turf(T.loc)) + Z.key = A.key + if(iscultist(U)) + cult.add_antagonist(Z.mind) + qdel(T) + Z << "You are playing a Wraith. Though relatively fragile, you are fast, deadly, and even able to phase through walls." + Z << "You are still bound to serve your creator, follow their orders and help them complete their goals at all costs." + Z.cancel_camera() + qdel(src) + if("Artificer") + var/mob/living/simple_animal/construct/builder/Z = new /mob/living/simple_animal/construct/builder (get_turf(T.loc)) + Z.key = A.key + if(iscultist(U)) + cult.add_antagonist(Z.mind) + qdel(T) + Z << "You are playing an Artificer. You are incredibly weak and fragile, but you are able to construct fortifications, repair allied constructs (by clicking on them), and even create new constructs" + Z << "You are still bound to serve your creator, follow their orders and help them complete their goals at all costs." + Z.cancel_camera() + qdel(src) +/obj/item/device/soulstone/proc/transfer_soul(var/choice as text, var/target, var/mob/U as mob). switch(choice) if("VICTIM") - var/mob/living/carbon/human/T = target - var/obj/item/device/soulstone/C = src - if(C.imprinted != "empty") - U << "\red Capture failed!: \black The soul stone has already been imprinted with [C.imprinted]'s mind!" - else - if ((T.health + T.halloss) > config.health_threshold_crit && T.stat != DEAD) - U << "\red Capture failed!: \black Kill or maim the victim first!" - else - if(T.client == null) - U << "\red Capture failed!: \black The soul has already fled it's mortal frame." - else - if(C.contents.len) - U << "\red Capture failed!: \black The soul stone is full! Use or free an existing soul to make room." - else - for(var/obj/item/W in T) - T.drop_from_inventory(W) - new /obj/effect/decal/remains/human(T.loc) //Spawns a skeleton - T.invisibility = 101 - var/atom/movable/overlay/animation = new /atom/movable/overlay( T.loc ) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = T - flick("dust-h", animation) - qdel(animation) - var/mob/living/simple_animal/shade/S = new /mob/living/simple_animal/shade( T.loc ) - S.loc = C //put shade in stone - S.status_flags |= GODMODE //So they won't die inside the stone somehow - S.canmove = 0//Can't move out of the soul stone - S.name = "Shade of [T.real_name]" - S.real_name = "Shade of [T.real_name]" - S.icon = T.icon - S.icon_state = T.icon_state - S.overlays = T.overlays - S.color = rgb(254,0,0) - S.alpha = 127 - if (T.client) - T.client.mob = S - S.cancel_camera() - C.icon_state = "soulstone2" - C.name = "Soul Stone: [S.real_name]" - S << "Your soul has been captured! You are now bound to [U.name]'s will, help them suceed in their goals at all costs." - U << "\blue Capture successful!: \black [T.real_name]'s soul has been ripped from their body and stored within the soul stone." - U << "The soulstone has been imprinted with [S.real_name]'s mind, it will no longer react to other souls." - C.imprinted = "[S.name]" - qdel(T) + transfer_human(target,U) if("SHADE") - var/mob/living/simple_animal/shade/T = target - var/obj/item/device/soulstone/C = src - if (T.stat == DEAD) - U << "\red Capture failed!: \black The shade has already been banished!" - else - if(C.contents.len) - U << "\red Capture failed!: \black The soul stone is full! Use or free an existing soul to make room." - else - if(T.name != C.imprinted) - U << "\red Capture failed!: \black The soul stone has already been imprinted with [C.imprinted]'s mind!" - else - T.loc = C //put shade in stone - T.status_flags |= GODMODE - T.canmove = 0 - T.health = T.maxHealth - C.icon_state = "soulstone2" - T << "Your soul has been recaptured by the soul stone, its arcane energies are reknitting your ethereal form" - U << "\blue Capture successful!: \black [T.name]'s has been recaptured and stored within the soul stone." + transfer_shade(target,U) if("CONSTRUCT") - var/obj/structure/constructshell/T = target - var/obj/item/device/soulstone/C = src - var/mob/living/simple_animal/shade/A = locate() in C - if(A) - var/construct_class = alert(U, "Please choose which type of construct you wish to create.",,"Juggernaut","Wraith","Artificer") - switch(construct_class) - if("Juggernaut") - var/mob/living/simple_animal/construct/armoured/Z = new /mob/living/simple_animal/construct/armoured (get_turf(T.loc)) - Z.key = A.key - if(iscultist(U)) - cult.add_antagonist(Z.mind) - qdel(T) - Z << "You are playing a Juggernaut. Though slow, you can withstand extreme punishment, and rip apart enemies and walls alike." - Z << "You are still bound to serve your creator, follow their orders and help them complete their goals at all costs." - Z.cancel_camera() - qdel(C) - - if("Wraith") - var/mob/living/simple_animal/construct/wraith/Z = new /mob/living/simple_animal/construct/wraith (get_turf(T.loc)) - Z.key = A.key - if(iscultist(U)) - cult.add_antagonist(Z.mind) - qdel(T) - Z << "You are playing a Wraith. Though relatively fragile, you are fast, deadly, and even able to phase through walls." - Z << "You are still bound to serve your creator, follow their orders and help them complete their goals at all costs." - Z.cancel_camera() - qdel(C) - - if("Artificer") - var/mob/living/simple_animal/construct/builder/Z = new /mob/living/simple_animal/construct/builder (get_turf(T.loc)) - Z.key = A.key - if(iscultist(U)) - cult.add_antagonist(Z.mind) - qdel(T) - Z << "You are playing an Artificer. You are incredibly weak and fragile, but you are able to construct fortifications, repair allied constructs (by clicking on them), and even create new constructs" - Z << "You are still bound to serve your creator, follow their orders and help them complete their goals at all costs." - Z.cancel_camera() - qdel(C) - else - U << "\red Creation failed!: \black The soul stone is empty! Go kill someone!" - return + transfer_construct(target,U) diff --git a/code/modules/mob/living/simple_animal/shade.dm b/code/modules/mob/living/simple_animal/shade.dm index 359db24c636..f8ed654b958 100644 --- a/code/modules/mob/living/simple_animal/shade.dm +++ b/code/modules/mob/living/simple_animal/shade.dm @@ -37,7 +37,8 @@ /mob/living/simple_animal/shade/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri if(istype(O, /obj/item/device/soulstone)) - O.transfer_soul("SHADE", src, user) + var/obj/item/device/soulstone/S = O; + S.transfer_soul("SHADE", src, user) return /mob/living/simple_animal/shade/proc/OnDeathInLife() From 14393ea706831a1fd2222e6bfaa50ebcfea2de49 Mon Sep 17 00:00:00 2001 From: Sebastian Broberg Date: Sun, 27 Dec 2015 17:05:08 +0100 Subject: [PATCH 4/4] Few refraction --- .../simple_animal/constructs/soulstone.dm | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/code/modules/mob/living/simple_animal/constructs/soulstone.dm b/code/modules/mob/living/simple_animal/constructs/soulstone.dm index 734c97e4d96..7e182c6f09d 100644 --- a/code/modules/mob/living/simple_animal/constructs/soulstone.dm +++ b/code/modules/mob/living/simple_animal/constructs/soulstone.dm @@ -72,7 +72,7 @@ A.status_flags &= ~GODMODE A.canmove = 1 A << "You have been released from your prison, but you are still bound to [U.name]'s will. Help them suceed in their goals at all costs." - A.loc = U.loc + A.forceMove(U.loc) A.cancel_camera() src.icon_state = "soulstone" attack_self(U) @@ -102,16 +102,16 @@ if(!istype(T)) return; if(src.imprinted != "empty") - U << "\red Capture failed!: \black The soul stone has already been imprinted with [src.imprinted]'s mind!" + U << "Capture failed!: The soul stone has already been imprinted with [src.imprinted]'s mind!" return if ((T.health + T.halloss) > config.health_threshold_crit && T.stat != DEAD) - U << "\red Capture failed!: \black Kill or maim the victim first!" + U << "Capture failed!: Kill or maim the victim first!" return if(T.client == null) - U << "\red Capture failed!: \black The soul has already fled it's mortal frame." + U << "Capture failed!: The soul has already fled it's mortal frame." return if(src.contents.len) - U << "\red Capture failed!: \black The soul stone is full! Use or free an existing soul to make room." + U << "Capture failed!: The soul stone is full! Use or free an existing soul to make room." return for(var/obj/item/W in T) @@ -146,7 +146,7 @@ src.icon_state = "soulstone2" src.name = "Soul Stone: [S.real_name]" S << "Your soul has been captured! You are now bound to [U.name]'s will, help them suceed in their goals at all costs." - U << "\blue Capture successful!: \black [T.real_name]'s soul has been ripped from their body and stored within the soul stone." + U << "Capture successful! : [T.real_name]'s soul has been ripped from their body and stored within the soul stone." U << "The soulstone has been imprinted with [S.real_name]'s mind, it will no longer react to other souls." src.imprinted = "[S.name]" qdel(T) @@ -155,13 +155,13 @@ if(!istype(T)) return; if (T.stat == DEAD) - U << "\red Capture failed!: \black The shade has already been banished!" + U << "Capture failed!: The shade has already been banished!" return if(src.contents.len) - U << "\red Capture failed!: \black The soul stone is full! Use or free an existing soul to make room." + U << "Capture failed!: The soul stone is full! Use or free an existing soul to make room." return if(T.name != src.imprinted) - U << "\red Capture failed!: \black The soul stone has already been imprinted with [src.imprinted]'s mind!" + U << "Capture failed!: The soul stone has already been imprinted with [src.imprinted]'s mind!" return T.loc = src //put shade in stone @@ -171,11 +171,11 @@ src.icon_state = "soulstone2" T << "Your soul has been recaptured by the soul stone, its arcane energies are reknitting your ethereal form" - U << "\blue Capture successful!: \black [T.name]'s has been recaptured and stored within the soul stone." + U << "Capture successful! : [T.name]'s has been recaptured and stored within the soul stone." /obj/item/device/soulstone/proc/transfer_construct(var/obj/structure/constructshell/T,var/mob/U) var/mob/living/simple_animal/shade/A = locate() in src if(!A) - U << "\red Creation failed!: \black The soul stone is empty! Go kill someone!" + U << "Capture failed!: The soul stone is empty! Go kill someone!" return; var/construct_class = alert(U, "Please choose which type of construct you wish to create.",,"Juggernaut","Wraith","Artificer") switch(construct_class)