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 "interface\skin.dmf"
#include "maps\tgstation.2.0.8.dmm"
// END_INCLUDE
// END_INCLUDE

View File

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

View File

@@ -509,13 +509,8 @@
// human > monkey
var/mob/living/carbon/human/H = M
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)
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
continue
H.drop_from_slot(W)
@@ -553,7 +548,7 @@
M.viruses -= D
for(var/obj/T in (M.contents-implants))
for(var/obj/T in (M.contents))
del(T)
//for(var/R in M.organs)
// del(M.organs[text("[]", R)])
@@ -584,12 +579,8 @@
// monkey > human,
var/mob/living/carbon/monkey/Mo = M
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)
for(var/obj/item/W in (Mo.contents-implants))
for(var/obj/item/W in (Mo.contents))
Mo.drop_from_slot(W)
M.update_clothing()
M.monkeyizing = 1

View File

@@ -56,11 +56,11 @@
/proc/PickObjectiveFromList(var/list/objectivesArray)
var/list/datum/objectives = objectivesArray[1]
var/pick_index = text2num(pickweight(objectivesArray[2]))
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].")
return objectives[pick_index]
/proc/RemoveObjectiveFromList(var/list/objectiveArray, var/datum/objective/objective)
@@ -97,7 +97,7 @@
if(1 to 55) //Theft Objectives (55% chance)
var/datum/objective/objective = PickObjectiveFromList(theftobjectives)
for(1 to 10)
if(objective.points + totalweight <= 110)
if(objective.points + totalweight <= 100)
break
objective = PickObjectiveFromList(theftobjectives)
chosenobjectives += objective
@@ -107,7 +107,7 @@
var/datum/objective/assassinate/objective = PickObjectiveFromList(killobjectives)
world << objective
for(1 to 10)
if(objective.points + totalweight <= 110)
if(objective.points + totalweight <= 100)
break
objective = PickObjectiveFromList(killobjectives)
if(!objective)
@@ -128,7 +128,7 @@
if(93 to 95) //Framing Objectives (3% chance)
var/datum/objective/objective = PickObjectiveFromList(frameobjectives)
for(1 to 10)
if(objective.points + totalweight <= 110)
if(objective.points + totalweight <= 100)
break
objective = PickObjectiveFromList(frameobjectives)
if(!objective)
@@ -149,7 +149,7 @@
if(96 to 100) //Protection Objectives (5% chance)
var/datum/objective/protection/objective = PickObjectiveFromList(protectobjectives)
for(1 to 10)
if(objective.points + totalweight <= 110)
if(objective.points + totalweight <= 100)
break
objective = PickObjectiveFromList(protectobjectives)
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/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)
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.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/glasses/sunglasses(H), H.slot_glasses)
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.implanted = 1
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/weapon/handcuffs(H), H.slot_in_backpack)
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.implanted = 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/weapon/handcuffs(H), H.slot_in_backpack)
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.implanted = 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/reagent_containers/food/snacks/candy_corn(H), H.slot_h_store)
// 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.implanted = 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/weapon/handcuffs(H), H.slot_s_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.implanted = 1
return 1

View File

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

View File

@@ -395,7 +395,9 @@
//Add an implant if needed
var/obj/item/weapon/implant/health/imp = locate(/obj/item/weapon/implant/health, subject)
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
R.fields["imp"] = "\ref[imp]"
//Update it if needed

View File

@@ -316,8 +316,13 @@ var
// - Just display a garbled message -
else
heard_garbled += R
for(var/obj/item/weapon/implant/imp in R)
imp.hear(message,M)
if(hasorgans(R))
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 ###### */
@@ -595,8 +600,13 @@ var
// - Just display a garbled message -
heard_garbled += R
for(var/obj/item/weapon/implant/imp in R)
imp.hear(text,M)
if(hasorgans(R))
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 ###### */

View File

@@ -66,7 +66,7 @@
L[tmpname] = R
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
else
var/mob/M = I.loc

View File

@@ -49,10 +49,11 @@
if(ishuman(M) && ishuman(user))
if(user.mind in ticker.mode.head_revolutionaries)
var/revsafe = 0
for(var/obj/item/weapon/implant/loyalty/L in M)
if(L && L.implanted)
revsafe = 1
break
for(var/datum/organ/external/O in M.organs)
for(var/obj/item/weapon/implant/loyalty/L in O.implant)
if(L && L.implanted)
revsafe = 1
break
if(M.mind.has_been_rev)
revsafe = 2
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("'" = "","\"" = "",">" = "","<" = "","(" = "",")" = "")
msg = sanitize_simple(msg, replacechars)
if(findtext(msg,phrase))
if(istype(loc, /mob/))
var/mob/T = loc
if(istype(imp_in, /mob/))
var/mob/T = imp_in
T.gib()
explosion(find_loc(src), 1, 3, 4, 6, 3)
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
process()
var/mob/M = src.loc
var/mob/M = imp_in
if(isnull(M)) // If the mob got gibbed
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")

View File

@@ -60,7 +60,7 @@ Frequency:
src.temp += "<B>Extranneous Signals:</B><BR>"
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
else
var/mob/M = W.loc

View File

@@ -107,10 +107,19 @@
break
else
C.images += image(tempHud,perp,"hudunknown")
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")
if(hasorgans(perp))
for(var/datum/organ/external/E in perp)
for(var/obj/item/weapon/implant/I in E.implant)
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")
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/m_type = 1
for (var/obj/item/weapon/implant/I in src)
if (I.implanted)
I.trigger(act, src)
for(var/named in organs)
var/datum/organ/external/F = organs[named]
for (var/obj/item/weapon/implant/I in F.implant)
if (I.implanted)
I.trigger(act, src)
if(src.stat == 2.0 && (act != "deathgasp"))
return

View File

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