Added implant removal surgery.

If you fail the step, has small chance of activating implant.
Gives you a sound and ~15 ticks to run away like hell.

Changes I did to other parts to make this possible:
-Implants are now organ-based, not mob-based
-Part of implant working code is moved to appropriate activate() procs
This commit is contained in:
Chinsky
2013-01-06 11:25:53 +04:00
parent 26efcd94cb
commit 5f0c39f1cf
6 changed files with 138 additions and 35 deletions

View File

@@ -39,6 +39,16 @@
// evil infection stuff that will make everyone hate me // evil infection stuff that will make everyone hate me
var/can_infect = 0 var/can_infect = 0
proc/isright(obj/item/tool) //is it is a required surgical tool for this step
return (istype(tool,required_tool))
proc/isacceptable(obj/item/tool) //is it is an accepted replacement tool for this step
if (allowed_tools)
for (var/T in allowed_tools)
if (istype(tool,T))
return 1
return 0
// Build this list by iterating over all typesof(/datum/surgery_step) and sorting the results by priority // Build this list by iterating over all typesof(/datum/surgery_step) and sorting the results by priority
@@ -1226,3 +1236,68 @@ proc/spread_germs_to_organ(datum/organ/external/E, mob/living/carbon/human/user)
user:bloody_hands(target, 0) user:bloody_hands(target, 0)
user:bloody_body(target) user:bloody_body(target)
//////////////////////////////////////////////////////////////////
// IMPLANT REMOVAL SURGERY //
//////////////////////////////////////////////////////////////////
/datum/surgery_step/implant_removal
required_tool = /obj/item/weapon/hemostat
allowed_tools = list(/obj/item/weapon/wirecutters, /obj/item/weapon/kitchen/utensil/fork)
min_duration = 80
max_duration = 100
can_use(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
return affected.open == 2 && !(affected.status & ORGAN_BLEEDING)
begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts poking around inside the incision on [target]'s [affected.display_name] with \the [tool].", \
"You start poking around inside the incision on [target]'s [affected.display_name] with \the [tool]" )
target.custom_pain("The pain in your chest is living hell!",1)
end_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/chest/affected = target.get_organ("chest")
var/find_prob = 0
if (affected.implants.len)
var/obj/item/weapon/implant/imp = affected.implants[1]
if (imp.islegal())
find_prob +=60
else
find_prob +=40
if (isright(tool))
find_prob +=20
if (prob(find_prob))
user.visible_message("\blue [user] takes something out of incision on [target]'s [affected.display_name] with \the [tool].", \
"\blue You take something out of incision on [target]'s [affected.display_name]s with \the [tool]." )
var/obj/item/weapon/implant/imp = affected.implants[1]
affected.implants -= imp
imp.loc = get_turf(target)
imp.imp_in = null
imp.implanted = 0
else
user.visible_message("\blue [user] could not find anything inside [target]'s [affected.display_name], and pulls \the [tool] out.", \
"\blue You could not find anything inside [target]'s [affected.display_name]." )
if (ishuman(user) && prob(80)) user:bloody_hands(target, 0)
fail_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/chest/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, scraping tissue inside [target]'s [affected.display_name] with \the [tool]!", \
"\red Your hand slips, scraping tissue inside [target]'s [affected.display_name] with \the [tool]!")
affected.createwound(CUT, 20)
if (affected.implants.len)
var/fail_prob = 10
if (!isright(tool))
fail_prob += 30
if (prob(fail_prob))
var/obj/item/weapon/implant/imp = affected.implants[1]
user.visible_message("\red Something beeps inside [target]'s [affected.display_name]!")
playsound(imp.loc, 'sound/weapons/armbomb.ogg', 75, 1, -3)
spawn(15)
imp.activate()
if (ishuman(user))
user:bloody_hands(target, 0)
user:bloody_body(target)

View File

@@ -34,6 +34,7 @@
var/open = 0 var/open = 0
var/stage = 0 var/stage = 0
var/list/implants = list()
// INTERNAL germs inside the organ, this is BAD if it's greater 0 // INTERNAL germs inside the organ, this is BAD if it's greater 0
var/germ_level = 0 var/germ_level = 0

View File

@@ -186,26 +186,21 @@
if (!istype(M)) // not sure if this is the right thing... if (!istype(M)) // not sure if this is the right thing...
return return
if (can_operate(M)) //Checks if mob is lying down on table for surgery if (can_operate(M)) //Checks if mob is lying down on table for surgery
if(istype(M,/mob/living/carbon)) if(istype(M,/mob/living/carbon))
if (user.a_intent != "harm") if (user.a_intent != "harm") //check for Hippocratic Oath
if(surgery_steps.len == 0) build_surgery_steps_list() if(surgery_steps.len == 0) build_surgery_steps_list()
for(var/datum/surgery_step/S in surgery_steps) for(var/datum/surgery_step/S in surgery_steps)
//check if tool is right or close enough if( S.isright(src) || S.isacceptable(src) ) //check if tool is right or close enough
var/right = istype(src, S.required_tool) if(S.can_use(user, M, user.zone_sel.selecting, src)) //and if this step is possible
if (!right && S.allowed_tools) S.begin_step(user, M, user.zone_sel.selecting, src) //start on it
for (var/T in S.allowed_tools) if(do_mob(user, M, rand(S.min_duration, S.max_duration))) //if user did nto move or changed hands
if (istype(src, T)) S.end_step(user, M, user.zone_sel.selecting, src) //finish successfully
right = 1 else //or
if(right && S.can_use(user, M, user.zone_sel.selecting, src)) //is this step possible? S.fail_step(user, M, user.zone_sel.selecting, src) //malpractice~
S.begin_step(user, M, user.zone_sel.selecting, src)
if(do_mob(user, M, rand(S.min_duration, S.max_duration)))
S.end_step(user, M, user.zone_sel.selecting, src)
else
S.fail_step(user, M, user.zone_sel.selecting, src)
return //don't want to do weapony things after surgery return //don't want to do weapony things after surgery
if (is_surgery_tool(src))
return
var/messagesource = M var/messagesource = M

View File

@@ -1,7 +1,10 @@
/obj/item/weapon/implant /obj/item/weapon/implant
name = "implant" name = "implant"
icon = 'device.dmi'
icon_state = "implant"
var/implanted = null var/implanted = null
var/mob/imp_in = null var/mob/imp_in = null
var/datum/organ/external/part = null
color = "b" color = "b"
var/allow_reagents = 0 var/allow_reagents = 0
@@ -23,8 +26,8 @@
proc/hear(message, source as mob) proc/hear(message, source as mob)
return return
proc/islegal()
return 0
/obj/item/weapon/implant/tracking /obj/item/weapon/implant/tracking
name = "tracking" name = "tracking"
@@ -82,6 +85,8 @@ Implant Specifics:<BR>"}
if(src.imp_in) if(src.imp_in)
src.imp_in.gib() src.imp_in.gib()
islegal()
return 0
//BS12 Explosive //BS12 Explosive
/obj/item/weapon/implant/explosive /obj/item/weapon/implant/explosive
name = "explosive implant" name = "explosive implant"
@@ -110,6 +115,10 @@ Implant Specifics:<BR>"}
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))
activate()
del(src)
activate()
if(istype(imp_in, /mob/)) if(istype(imp_in, /mob/))
var/mob/T = imp_in var/mob/T = imp_in
T.gib() T.gib()
@@ -117,7 +126,6 @@ Implant Specifics:<BR>"}
var/turf/t = get_turf(imp_in) var/turf/t = get_turf(imp_in)
if(t) if(t)
t.hotspot_expose(3500,125) t.hotspot_expose(3500,125)
del(src)
implanted(mob/source as mob) implanted(mob/source as mob)
phrase = input("Choose activation phrase:") as text phrase = input("Choose activation phrase:") as text
@@ -127,6 +135,8 @@ Implant Specifics:<BR>"}
usr << "The implanted explosive implant in [source] can be activated by saying something containing the phrase ''[src.phrase]'', <B>say [src.phrase]</B> to attempt to activate." usr << "The implanted explosive implant in [source] can be activated by saying something containing the phrase ''[src.phrase]'', <B>say [src.phrase]</B> to attempt to activate."
return 1 return 1
islegal()
return 0
/obj/item/weapon/implant/chem /obj/item/weapon/implant/chem
name = "chem" name = "chem"
@@ -266,14 +276,16 @@ the implant may become unstable and either pre-maturely inject the subject or si
process() process()
if (!implanted) return if (!implanted) return
var/mob/M = imp_in var/mob/M = imp_in
var/area/t = get_area(M)
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) activate()
a.autosay("[mobname] has died-zzzzt in-in-in...", "[mobname]'s Death Alarm")
del(a)
processing_objects.Remove(src)
else if(M.stat == 2) else if(M.stat == 2)
activate("death")
activate(var/cause)
var/mob/M = imp_in
var/area/t = get_area(M)
if(cause == "death")
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)
if(istype(t, /area/syndicate_station) || istype(t, /area/syndicate_mothership) || istype(t, /area/shuttle/syndicate_elite) ) if(istype(t, /area/syndicate_station) || istype(t, /area/syndicate_mothership) || istype(t, /area/shuttle/syndicate_elite) )
//give the syndies a bit of stealth //give the syndies a bit of stealth
@@ -282,7 +294,11 @@ the implant may become unstable and either pre-maturely inject the subject or si
a.autosay("[mobname] has died in [t.name]!", "[mobname]'s Death Alarm") a.autosay("[mobname] has died in [t.name]!", "[mobname]'s Death Alarm")
del(a) del(a)
processing_objects.Remove(src) processing_objects.Remove(src)
else
var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset(null)
a.autosay("[mobname] has died-zzzzt in-in-in...", "[mobname]'s Death Alarm")
del(a)
processing_objects.Remove(src)
implanted(mob/source as mob) implanted(mob/source as mob)
mobname = source.real_name mobname = source.real_name
@@ -314,13 +330,20 @@ the implant may become unstable and either pre-maturely inject the subject or si
if (emote == src.activation_emote) if (emote == src.activation_emote)
source << "The air glows as \the [src.scanned.name] uncompresses." source << "The air glows as \the [src.scanned.name] uncompresses."
var/turf/t = get_turf(source) activate()
activate()
var/turf/t = get_turf(src)
src.scanned.loc = t src.scanned.loc = t
if (part) part.implants -= src
del src del src
implanted(mob/source as mob) implanted(mob/source as mob)
src.activation_emote = input("Choose activation emote:") in list("blink", "blink_r", "eyebrow", "chuckle", "twitch_s", "frown", "nod", "blush", "giggle", "grin", "groan", "shrug", "smile", "pale", "sniff", "whimper", "wink") src.activation_emote = input("Choose activation emote:") in list("blink", "blink_r", "eyebrow", "chuckle", "twitch_s", "frown", "nod", "blush", "giggle", "grin", "groan", "shrug", "smile", "pale", "sniff", "whimper", "wink")
if (source.mind)
source.mind.store_memory("Freedom implant can be activated by using the [src.activation_emote] emote, <B>say *[src.activation_emote]</B> to attempt to activate.", 0, 0) source.mind.store_memory("Freedom implant can be activated by using the [src.activation_emote] emote, <B>say *[src.activation_emote]</B> to attempt to activate.", 0, 0)
source << "The implanted freedom implant can be activated by using the [src.activation_emote] emote, <B>say *[src.activation_emote]</B> to attempt to activate." source << "The implanted freedom implant can be activated by using the [src.activation_emote] emote, <B>say *[src.activation_emote]</B> to attempt to activate."
return 1 return 1
islegal()
return 0

View File

@@ -40,6 +40,11 @@
src.imp.loc = M src.imp.loc = M
src.imp.imp_in = M src.imp.imp_in = M
src.imp.implanted = 1 src.imp.implanted = 1
if (ishuman(M))
var/mob/living/carbon/human/H = M
var/datum/organ/external/affected = H.get_organ(user.zone_sel.selecting)
affected.implants += src.imp
imp.part = affected
src.imp = null src.imp = null
update() update()
@@ -107,6 +112,10 @@
/obj/item/weapon/implanter/compressed/afterattack(atom/A, mob/user as mob) /obj/item/weapon/implanter/compressed/afterattack(atom/A, mob/user as mob)
if(istype(A,/obj/item) && imp) if(istype(A,/obj/item) && imp)
var/obj/item/weapon/implant/compressed/c = imp
if (c.scanned)
user << "\red Something is already scanned inside the implant!"
return
imp:scanned = A imp:scanned = A
A.loc.contents.Remove(A) A.loc.contents.Remove(A)
update() update()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB