Fixes for a lot of implant things. Fixes some runtimes related to explosive and death alarm implants.

This commit is contained in:
SkyMarshal
2012-04-10 12:38:34 -07:00
parent 076b899718
commit 49d6a0092c
17 changed files with 90 additions and 61 deletions

View File

@@ -1140,4 +1140,4 @@
#include "code\ZAS\Variable Settings.dm" #include "code\ZAS\Variable Settings.dm"
#include "interface\skin.dmf" #include "interface\skin.dmf"
#include "maps\tgstation.2.0.8.dmm" #include "maps\tgstation.2.0.8.dmm"
// END_INCLUDE // END_INCLUDE

View File

@@ -377,11 +377,12 @@
for (var/mob/M in W) for (var/mob/M in W)
W |= M.contents W |= M.contents
if(ishuman(M)) if(hasorgans(M))
var/mob/living/carbon/human/G = M var/mob/living/carbon/G = M
for(var/name in G.organs) for(var/name in G:organs)
var/datum/organ/external/F = G.organs[name] var/datum/organ/external/F = G:organs[name]
W |= F.implant for(var/obj/item/weapon/implant/I in F.implant)
W |= I
for (var/obj/item/device/pda/M in W) for (var/obj/item/device/pda/M in W)
W |= M.contents W |= M.contents

View File

@@ -509,13 +509,8 @@
// human > monkey // human > monkey
var/mob/living/carbon/human/H = M var/mob/living/carbon/human/H = M
H.monkeyizing = 1 H.monkeyizing = 1
var/list/implants = list() //Try to preserve implants.
for(var/obj/item/weapon/implant/W in H)
implants += W
W.loc = null
if(!connected) if(!connected)
for(var/obj/item/W in (H.contents-implants)) for(var/obj/item/W in (H.contents))
if (W==H.w_uniform) // will be teared if (W==H.w_uniform) // will be teared
continue continue
H.drop_from_slot(W) H.drop_from_slot(W)
@@ -553,7 +548,7 @@
M.viruses -= D M.viruses -= D
for(var/obj/T in (M.contents-implants)) for(var/obj/T in (M.contents))
del(T) del(T)
//for(var/R in M.organs) //for(var/R in M.organs)
// del(M.organs[text("[]", R)]) // del(M.organs[text("[]", R)])
@@ -584,12 +579,8 @@
// monkey > human, // monkey > human,
var/mob/living/carbon/monkey/Mo = M var/mob/living/carbon/monkey/Mo = M
Mo.monkeyizing = 1 Mo.monkeyizing = 1
var/list/implants = list() //Still preserving implants
for(var/obj/item/weapon/implant/W in Mo)
implants += W
W.loc = null
if(!connected) if(!connected)
for(var/obj/item/W in (Mo.contents-implants)) for(var/obj/item/W in (Mo.contents))
Mo.drop_from_slot(W) Mo.drop_from_slot(W)
M.update_clothing() M.update_clothing()
M.monkeyizing = 1 M.monkeyizing = 1

View File

@@ -56,11 +56,11 @@
/proc/PickObjectiveFromList(var/list/objectivesArray) /proc/PickObjectiveFromList(var/list/objectivesArray)
var/list/datum/objectives = objectivesArray[1] var/list/datum/objectives = objectivesArray[1]
var/pick_index = text2num(pickweight(objectivesArray[2])) var/pick_index = text2num(pickweight(objectivesArray[2]))
if (pick_index > objectives.len || pick_index < 1) if (pick_index > objectives.len || pick_index < 1)
log_admin("Objective picking failed. Error logged. One or more traitors will need to be manually-assigned objectives") log_admin("Objective picking failed. Error logged. One or more traitors will need to be manually-assigned objectives. Pick_index was [pick_index]. Tell Sky.")
message_admins("Objective picking failed. Error logged. One or more traitors will need to be manually-assigned objectives. Pick_index was [pick_index]. Tell Sky.")
CRASH("Objective picking failed. Pick_index was [pick_index].") CRASH("Objective picking failed. Pick_index was [pick_index].")
return objectives[pick_index] return objectives[pick_index]
/proc/RemoveObjectiveFromList(var/list/objectiveArray, var/datum/objective/objective) /proc/RemoveObjectiveFromList(var/list/objectiveArray, var/datum/objective/objective)
@@ -97,7 +97,7 @@
if(1 to 55) //Theft Objectives (55% chance) if(1 to 55) //Theft Objectives (55% chance)
var/datum/objective/objective = PickObjectiveFromList(theftobjectives) var/datum/objective/objective = PickObjectiveFromList(theftobjectives)
for(1 to 10) for(1 to 10)
if(objective.points + totalweight <= 110) if(objective.points + totalweight <= 100)
break break
objective = PickObjectiveFromList(theftobjectives) objective = PickObjectiveFromList(theftobjectives)
chosenobjectives += objective chosenobjectives += objective
@@ -107,7 +107,7 @@
var/datum/objective/assassinate/objective = PickObjectiveFromList(killobjectives) var/datum/objective/assassinate/objective = PickObjectiveFromList(killobjectives)
world << objective world << objective
for(1 to 10) for(1 to 10)
if(objective.points + totalweight <= 110) if(objective.points + totalweight <= 100)
break break
objective = PickObjectiveFromList(killobjectives) objective = PickObjectiveFromList(killobjectives)
if(!objective) if(!objective)
@@ -128,7 +128,7 @@
if(93 to 95) //Framing Objectives (3% chance) if(93 to 95) //Framing Objectives (3% chance)
var/datum/objective/objective = PickObjectiveFromList(frameobjectives) var/datum/objective/objective = PickObjectiveFromList(frameobjectives)
for(1 to 10) for(1 to 10)
if(objective.points + totalweight <= 110) if(objective.points + totalweight <= 100)
break break
objective = PickObjectiveFromList(frameobjectives) objective = PickObjectiveFromList(frameobjectives)
if(!objective) if(!objective)
@@ -149,7 +149,7 @@
if(96 to 100) //Protection Objectives (5% chance) if(96 to 100) //Protection Objectives (5% chance)
var/datum/objective/protection/objective = PickObjectiveFromList(protectobjectives) var/datum/objective/protection/objective = PickObjectiveFromList(protectobjectives)
for(1 to 10) for(1 to 10)
if(objective.points + totalweight <= 110) if(objective.points + totalweight <= 100)
break break
objective = PickObjectiveFromList(protectobjectives) objective = PickObjectiveFromList(protectobjectives)
if(!objective) if(!objective)

View File

@@ -233,7 +233,9 @@
synd_mob.equip_if_possible(new /obj/item/ammo_magazine/a12mm(synd_mob), synd_mob.slot_in_backpack) synd_mob.equip_if_possible(new /obj/item/ammo_magazine/a12mm(synd_mob), synd_mob.slot_in_backpack)
synd_mob.equip_if_possible(new /obj/item/weapon/reagent_containers/pill/cyanide(synd_mob), synd_mob.slot_in_backpack) synd_mob.equip_if_possible(new /obj/item/weapon/reagent_containers/pill/cyanide(synd_mob), synd_mob.slot_in_backpack)
synd_mob.equip_if_possible(new /obj/item/weapon/gun/projectile/automatic/c20r(synd_mob), synd_mob.slot_belt) synd_mob.equip_if_possible(new /obj/item/weapon/gun/projectile/automatic/c20r(synd_mob), synd_mob.slot_belt)
var/obj/item/weapon/implant/dexplosive/E = new/obj/item/weapon/implant/dexplosive(synd_mob) var/datum/organ/external/O = pick(synd_mob.organs)
var/obj/item/weapon/implant/dexplosive/E = new/obj/item/weapon/implant/dexplosive(O)
O.implant += E
E.imp_in = synd_mob E.imp_in = synd_mob
E.implanted = 1 E.implanted = 1

View File

@@ -18,7 +18,9 @@
H.equip_if_possible(new /obj/item/clothing/head/caphat(H), H.slot_head) H.equip_if_possible(new /obj/item/clothing/head/caphat(H), H.slot_head)
H.equip_if_possible(new /obj/item/clothing/glasses/sunglasses(H), H.slot_glasses) H.equip_if_possible(new /obj/item/clothing/glasses/sunglasses(H), H.slot_glasses)
H.equip_if_possible(new /obj/item/weapon/storage/id_kit(H), H.slot_in_backpack) H.equip_if_possible(new /obj/item/weapon/storage/id_kit(H), H.slot_in_backpack)
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) var/datum/organ/external/O = pick(H.organs)
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(O)
O.implant += L
L.imp_in = H L.imp_in = H
L.implanted = 1 L.implanted = 1
world << "<b>[H.real_name] is the captain!</b>" world << "<b>[H.real_name] is the captain!</b>"

View File

@@ -23,7 +23,9 @@
H.equip_if_possible(new /obj/item/clothing/glasses/sunglasses/sechud(H), H.slot_glasses) H.equip_if_possible(new /obj/item/clothing/glasses/sunglasses/sechud(H), H.slot_glasses)
H.equip_if_possible(new /obj/item/weapon/handcuffs(H), H.slot_in_backpack) H.equip_if_possible(new /obj/item/weapon/handcuffs(H), H.slot_in_backpack)
H.equip_if_possible(new /obj/item/weapon/gun/energy/gun(H), H.slot_s_store) H.equip_if_possible(new /obj/item/weapon/gun/energy/gun(H), H.slot_s_store)
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) var/datum/organ/external/O = pick(H.organs)
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(O)
O.implant += L
L.imp_in = H L.imp_in = H
L.implanted = 1 L.implanted = 1
return 1 return 1
@@ -53,7 +55,9 @@
H.equip_if_possible(new /obj/item/clothing/glasses/sunglasses/sechud(H), H.slot_glasses) H.equip_if_possible(new /obj/item/clothing/glasses/sunglasses/sechud(H), H.slot_glasses)
H.equip_if_possible(new /obj/item/weapon/handcuffs(H), H.slot_in_backpack) H.equip_if_possible(new /obj/item/weapon/handcuffs(H), H.slot_in_backpack)
H.equip_if_possible(new /obj/item/device/flash(H), H.slot_l_store) H.equip_if_possible(new /obj/item/device/flash(H), H.slot_l_store)
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) var/datum/organ/external/O = pick(H.organs)
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(O)
O.implant += L
L.imp_in = H L.imp_in = H
L.implanted = 1 L.implanted = 1
return 1 return 1
@@ -92,7 +96,9 @@
H.equip_if_possible(new /obj/item/weapon/zippo(H), H.slot_l_store) H.equip_if_possible(new /obj/item/weapon/zippo(H), H.slot_l_store)
// H.equip_if_possible(new /obj/item/weapon/reagent_containers/food/snacks/candy_corn(H), H.slot_h_store) // H.equip_if_possible(new /obj/item/weapon/reagent_containers/food/snacks/candy_corn(H), H.slot_h_store)
// No... just no. --SkyMarshal // No... just no. --SkyMarshal
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) var/datum/organ/external/O = pick(H.organs)
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(O)
O.implant += L
L.imp_in = H L.imp_in = H
L.implanted = 1 L.implanted = 1
return 1 return 1
@@ -122,7 +128,9 @@
H.equip_if_possible(new /obj/item/clothing/gloves/red(H), H.slot_gloves) H.equip_if_possible(new /obj/item/clothing/gloves/red(H), H.slot_gloves)
H.equip_if_possible(new /obj/item/weapon/handcuffs(H), H.slot_s_store) H.equip_if_possible(new /obj/item/weapon/handcuffs(H), H.slot_s_store)
H.equip_if_possible(new /obj/item/device/flash(H), H.slot_l_store) H.equip_if_possible(new /obj/item/device/flash(H), H.slot_l_store)
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) var/datum/organ/external/O = pick(H.organs)
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(O)
O.implant += L
L.imp_in = H L.imp_in = H
L.implanted = 1 L.implanted = 1
return 1 return 1

View File

@@ -253,7 +253,7 @@
AN = "[e.wound]:" AN = "[e.wound]:"
if(e.open) if(e.open)
open = "OPEN:" open = "OPEN:"
if(e.implant) if(e.implant && e.implant.len)
imp = "IMPLANT:" imp = "IMPLANT:"
if(!AN && !open && !infected & !imp) if(!AN && !open && !infected & !imp)
AN = "None" AN = "None"

View File

@@ -395,7 +395,9 @@
//Add an implant if needed //Add an implant if needed
var/obj/item/weapon/implant/health/imp = locate(/obj/item/weapon/implant/health, subject) var/obj/item/weapon/implant/health/imp = locate(/obj/item/weapon/implant/health, subject)
if (isnull(imp)) if (isnull(imp))
imp = new /obj/item/weapon/implant/health(subject) var/datum/organ/external/O = pick(subject.organs)
imp = new /obj/item/weapon/implant/health(O)
O.implant += imp
imp.implanted = subject imp.implanted = subject
R.fields["imp"] = "\ref[imp]" R.fields["imp"] = "\ref[imp]"
//Update it if needed //Update it if needed

View File

@@ -316,8 +316,13 @@ var
// - Just display a garbled message - // - Just display a garbled message -
else else
heard_garbled += R heard_garbled += R
for(var/obj/item/weapon/implant/imp in R) if(hasorgans(R))
imp.hear(message,M) for(var/datum/organ/external/O in R:organs)
for(var/obj/item/weapon/implant/imp in O.implant)
imp.hear(message,M)
else
for(var/obj/item/weapon/implant/imp in R)
imp.hear(message,M)
/* ###### Begin formatting and sending the message ###### */ /* ###### Begin formatting and sending the message ###### */
@@ -595,8 +600,13 @@ var
// - Just display a garbled message - // - Just display a garbled message -
heard_garbled += R heard_garbled += R
for(var/obj/item/weapon/implant/imp in R) if(hasorgans(R))
imp.hear(text,M) for(var/datum/organ/external/O in R:organs)
for(var/obj/item/weapon/implant/imp in O.implant)
imp.hear(text,M)
else
for(var/obj/item/weapon/implant/imp in R)
imp.hear(text,M)
/* ###### Begin formatting and sending the message ###### */ /* ###### Begin formatting and sending the message ###### */

View File

@@ -66,7 +66,7 @@
L[tmpname] = R L[tmpname] = R
for (var/obj/item/weapon/implant/tracking/I in world) for (var/obj/item/weapon/implant/tracking/I in world)
if (!I.implanted || !ismob(I.loc)) if (!I.implanted || !(istype(I.loc,/datum/organ/external) || ismob(loc)))
continue continue
else else
var/mob/M = I.loc var/mob/M = I.loc

View File

@@ -49,10 +49,11 @@
if(ishuman(M) && ishuman(user)) if(ishuman(M) && ishuman(user))
if(user.mind in ticker.mode.head_revolutionaries) if(user.mind in ticker.mode.head_revolutionaries)
var/revsafe = 0 var/revsafe = 0
for(var/obj/item/weapon/implant/loyalty/L in M) for(var/datum/organ/external/O in M.organs)
if(L && L.implanted) for(var/obj/item/weapon/implant/loyalty/L in O.implant)
revsafe = 1 if(L && L.implanted)
break revsafe = 1
break
if(M.mind.has_been_rev) if(M.mind.has_been_rev)
revsafe = 2 revsafe = 2
if(!revsafe) if(!revsafe)

View File

@@ -249,8 +249,8 @@ the implant may become unstable and either pre-maturely inject the subject or si
var/list/replacechars = list("'" = "","\"" = "",">" = "","<" = "","(" = "",")" = "") var/list/replacechars = list("'" = "","\"" = "",">" = "","<" = "","(" = "",")" = "")
msg = sanitize_simple(msg, replacechars) msg = sanitize_simple(msg, replacechars)
if(findtext(msg,phrase)) if(findtext(msg,phrase))
if(istype(loc, /mob/)) if(istype(imp_in, /mob/))
var/mob/T = loc var/mob/T = imp_in
T.gib() T.gib()
explosion(find_loc(src), 1, 3, 4, 6, 3) explosion(find_loc(src), 1, 3, 4, 6, 3)
var/turf/t = find_loc(src) var/turf/t = find_loc(src)
@@ -284,8 +284,8 @@ the implant may become unstable and either pre-maturely inject the subject or si
return dat return dat
process() process()
var/mob/M = src.loc var/mob/M = imp_in
if(isnull(M)) // If the mob got gibbed if(isnull(M)) // If the mob got gibbed
var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset(null) var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset(null)
a.autosay("states, \"[mobname] has died-zzzzt in-in-in...\"", "[mobname]'s Death Alarm") a.autosay("states, \"[mobname] has died-zzzzt in-in-in...\"", "[mobname]'s Death Alarm")

View File

@@ -60,7 +60,7 @@ Frequency:
src.temp += "<B>Extranneous Signals:</B><BR>" src.temp += "<B>Extranneous Signals:</B><BR>"
for (var/obj/item/weapon/implant/tracking/W in world) for (var/obj/item/weapon/implant/tracking/W in world)
if (!W.implanted || !ismob(W.loc)) if (!W.implanted || !(istype(W.loc,/datum/organ/external) || ismob(W.loc)))
continue continue
else else
var/mob/M = W.loc var/mob/M = W.loc

View File

@@ -107,10 +107,19 @@
break break
else else
C.images += image(tempHud,perp,"hudunknown") C.images += image(tempHud,perp,"hudunknown")
for(var/obj/item/weapon/implant/I in perp) if(hasorgans(perp))
if(I.implanted) for(var/datum/organ/external/E in perp)
if(istype(I,/obj/item/weapon/implant/tracking)) for(var/obj/item/weapon/implant/I in E.implant)
C.images += image(tempHud,perp,"hud_imp_tracking") if(I.implanted)
if(istype(I,/obj/item/weapon/implant/loyalty)) if(istype(I,/obj/item/weapon/implant/tracking))
C.images += image(tempHud,perp,"hud_imp_loyal") C.images += image(tempHud,perp,"hud_imp_tracking")
if(istype(I,/obj/item/weapon/implant/loyalty))
C.images += image(tempHud,perp,"hud_imp_loyal")
else
for(var/obj/item/weapon/implant/I in perp)
if(I.implanted)
if(istype(I,/obj/item/weapon/implant/tracking))
C.images += image(tempHud,perp,"hud_imp_tracking")
if(istype(I,/obj/item/weapon/implant/loyalty))
C.images += image(tempHud,perp,"hud_imp_loyal")

View File

@@ -9,9 +9,11 @@
var/muzzled = istype(src.wear_mask, /obj/item/clothing/mask/muzzle) var/muzzled = istype(src.wear_mask, /obj/item/clothing/mask/muzzle)
//var/m_type = 1 //var/m_type = 1
for (var/obj/item/weapon/implant/I in src) for(var/named in organs)
if (I.implanted) var/datum/organ/external/F = organs[named]
I.trigger(act, src) for (var/obj/item/weapon/implant/I in F.implant)
if (I.implanted)
I.trigger(act, src)
if(src.stat == 2.0 && (act != "deathgasp")) if(src.stat == 2.0 && (act != "deathgasp"))
return return

View File

@@ -347,11 +347,12 @@
for (var/mob/M in W) for (var/mob/M in W)
W |= M.contents W |= M.contents
if(ishuman(M)) if(hasorgans(M))
var/mob/living/carbon/human/G = M var/mob/living/carbon/G = M
for(var/name in G.organs) for(var/name in G:organs)
var/datum/organ/external/F = G.organs[name] var/datum/organ/external/F = G:organs[name]
W |= F.implant for(var/obj/item/weapon/implant/I in F.implant)
W |= I
for (var/obj/item/device/pda/M in W) for (var/obj/item/device/pda/M in W)
W |= M.contents W |= M.contents