From 37549fa0f1708225c1634eaa82269fe2eec8d5f0 Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Wed, 26 Aug 2015 14:46:41 +0100 Subject: [PATCH 01/11] Added IsSurgeon to the mind of new mobs --- code/modules/mob/new_player/new_player.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index f69af80601264..b39cabfff3d83 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -446,10 +446,12 @@ src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS cant last forever yo if(mind) - mind.active = 0 //we wish to transfer the key manually + mind.active = 0 //we wish to transfer the key manually if(mind.assigned_role == "Clown") //give them a clownname if they are a clown new_character.real_name = pick(clown_names) //I hate this being here of all places but unfortunately dna is based on real_name! new_character.rename_self("clown") + if(mind.assigned_role == "Medical Doctor" || mind.assigned_role == "Chief Medical officer" || mind.assigned_role == "Roboticist") //If they have a role with surgical knowledge + mind.isSurgeon = 1 //allow them to perform surgery without error mind.original = new_character mind.transfer_to(new_character) //won't transfer key since the mind is not active From 728373117fe6d857efba91bcdf02a2245722cc0c Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Wed, 26 Aug 2015 14:50:14 +0100 Subject: [PATCH 02/11] Added IsSurgeon to the mind of new mobs --- code/datums/mind.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 99c467825c4eb..2dd02216e3eed 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -39,6 +39,7 @@ var/memory var/assigned_role + var/isSurgeon = 0 //Stored in Mind for convenience var/special_role var/role_alt_title From 3a3c78782997b58ad08f579855c99f703b56702f Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Wed, 26 Aug 2015 14:56:44 +0100 Subject: [PATCH 03/11] 50% fail chance for non-surgeons --- code/modules/surgery/surgery.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index ccc6257c64b19..2784340baff34 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -97,9 +97,9 @@ proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool) S.begin_step(user, M, zone, tool) user.operating = 1//start on it //We had proper tools! (or RNG smiled.) and user did not move or change hands. - if(prob(S.tool_quality(tool)) && do_mob(user, M, rand(S.min_duration, S.max_duration))) + if(prob(S.tool_quality(tool)) && do_mob(user, M, rand(S.min_duration, S.max_duration)) && ((user.mind.isSurgeon) || (!user.mind.isSurgeon) && (prob(50)))) //if they aren't a surgeon, give them a 50% chance of succeeding S.end_step(user, M, zone, tool) //finish successfully - else if ((tool in user.contents) && user.Adjacent(M)) //or + else if ((tool in user.contents) && user.Adjacent(M) || ((!user.mind.isSurgeon) && (prob(50)))) //otherwise, fail the step S.fail_step(user, M, zone, tool) //malpractice~ else // This failing silently was a pain. user << "\red You must remain close to your patient to conduct surgery." From e6317bc69b21f3c2603532be6f43be8caa06d62d Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Wed, 26 Aug 2015 14:59:50 +0100 Subject: [PATCH 04/11] Groundwork for new failure system --- code/modules/surgery/surgery.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index 2784340baff34..51fb68a0a6fe6 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -96,15 +96,17 @@ proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool) M.op_stage.in_progress += zone S.begin_step(user, M, zone, tool) user.operating = 1//start on it + user.fail_next_op = 0 //We had proper tools! (or RNG smiled.) and user did not move or change hands. - if(prob(S.tool_quality(tool)) && do_mob(user, M, rand(S.min_duration, S.max_duration)) && ((user.mind.isSurgeon) || (!user.mind.isSurgeon) && (prob(50)))) //if they aren't a surgeon, give them a 50% chance of succeeding + if(prob(S.tool_quality(tool)) && do_mob(user, M, rand(S.min_duration, S.max_duration)) && ((user.mind.isSurgeon) || (!user.mind.isSurgeon) && (prob(50))) && (!user.fail_next_op)) //if they aren't a surgeon, give them a 50% chance of succeeding S.end_step(user, M, zone, tool) //finish successfully - else if ((tool in user.contents) && user.Adjacent(M) || ((!user.mind.isSurgeon) && (prob(50)))) //otherwise, fail the step + else if ((tool in user.contents) && user.Adjacent(M) || ((!user.mind.isSurgeon) && (prob(50))) || (user.fail_next_op)) //otherwise, fail the step S.fail_step(user, M, zone, tool) //malpractice~ else // This failing silently was a pain. user << "\red You must remain close to your patient to conduct surgery." M.op_stage.in_progress -= zone user.operating = 0 + user.fail_next_op = 0 if (ishuman(M)) var/mob/living/carbon/human/H = M H.update_surgery() From 5cc9abc489bbaeb0d96dca64d79b6dc29f8021f1 Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Wed, 26 Aug 2015 15:10:06 +0100 Subject: [PATCH 05/11] Added failop proc --- code/modules/mob/living/living.dm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 2c19a5a9dfb26..73725fff4d523 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -147,6 +147,9 @@ default behaviour is: src.health = 100 - src.getOxyLoss() - src.getToxLoss() - src.getFireLoss() - src.getBruteLoss() src << "\blue You have given up life and succumbed to death." +/mob/living/proc/failop() //Cleaner way of setting fail_next_op to true than repeating the code every time it's used + if(!src.fail_next_op) + src.fail_next_op = 1 /mob/living/proc/updatehealth() if(status_flags & GODMODE) @@ -466,6 +469,7 @@ default behaviour is: return /mob/living/Move(a, b, flag) + src.failop() if (buckled) return @@ -659,6 +663,7 @@ default behaviour is: resting = !resting src << "\blue You are now [resting ? "resting" : "getting up"]" + src.failop() /mob/living/proc/handle_ventcrawl(var/obj/machinery/atmospherics/unary/vent_pump/vent_found = null, var/ignore_items = 0) // -- TLE -- Merged by Carn if(stat) @@ -736,6 +741,7 @@ default behaviour is: if(!target_vent) return + src.failop() for(var/mob/O in viewers(src, null)) O.show_message(text("[src] scrambles into the ventillation ducts!"), 1) loc = target_vent From 844ef7b6572fc421b352f0a7a2354e8559a5d0f6 Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Wed, 26 Aug 2015 15:11:55 +0100 Subject: [PATCH 06/11] More failop --- code/modules/mob/living/living_defense.dm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index c1295cc3626f2..8e5cd1413223c 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -39,6 +39,7 @@ /mob/living/bullet_act(var/obj/item/projectile/P, var/def_zone) flash_weak_pain() + failop() //Being hit while using a cloaking device var/obj/item/weapon/cloaking_device/C = locate((/obj/item/weapon/cloaking_device) in src) @@ -92,6 +93,7 @@ apply_effect(EYE_BLUR, agony_amount/10) /mob/living/proc/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0) + failop() return 0 //only carbon liveforms have this proc /mob/living/emp_act(severity) @@ -116,6 +118,7 @@ visible_message("\blue \The [O] misses [src] narrowly!") return + failop() src.visible_message("\red [src] has been hit by [O].") var/armor = run_armor_check(null, "melee") @@ -236,6 +239,7 @@ location.hotspot_expose(fire_burn_temperature(), 50, 1) /mob/living/fire_act() + failop() adjust_fire_stacks(2) IgniteMob() From f1f6258d42c9ddc65b7ed5141bc27d022f49c5e6 Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Wed, 26 Aug 2015 19:15:05 +0100 Subject: [PATCH 07/11] Indentation issue --- code/modules/mob/living/living_defense.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 8e5cd1413223c..8934e35203ea6 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -94,7 +94,7 @@ /mob/living/proc/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0) failop() - return 0 //only carbon liveforms have this proc + return 0 //only carbon liveforms have this proc /mob/living/emp_act(severity) var/list/L = src.get_contents() @@ -255,7 +255,7 @@ return 0 //Scale quadratically so that single digit numbers of fire stacks don't burn ridiculously hot. - //lower limit of 700 K, same as matches and roughly the temperature of a cool flame. + //lower limit of 700 K, same as matches and roughly the temperature of a cool flame. return max(2.25*round(FIRESUIT_MAX_HEAT_PROTECTION_TEMPERATURE*(fire_stacks/FIRE_MAX_FIRESUIT_STACKS)**2), 700) /mob/living/proc/reagent_permeability() From 35bfe8fb52fe419765bfa5cfc928ec22926ca818 Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Mon, 31 Aug 2015 14:06:05 +0100 Subject: [PATCH 08/11] Hopefully fixed some things --- code/modules/surgery/surgery.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index 51fb68a0a6fe6..caec2363612b5 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -83,7 +83,7 @@ proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool) if (user.a_intent == I_HURT) //check for Hippocratic Oath return 0 var/zone = user.zone_sel.selecting - if(zone in M.op_stage.in_progress || user.operating) //Can't operate on someone repeatedly. + if((zone in M.op_stage.in_progress) || (user.operating)) //Can't operate on someone repeatedly. user << "\red You can't operate on this area while surgery is already in progress." return 1 for(var/datum/surgery_step/S in surgery_steps) @@ -94,13 +94,13 @@ proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool) if(step_is_valid == 2) // This is a failure that already has a message for failing. return 1 M.op_stage.in_progress += zone - S.begin_step(user, M, zone, tool) user.operating = 1//start on it user.fail_next_op = 0 + S.begin_step(user, M, zone, tool) //We had proper tools! (or RNG smiled.) and user did not move or change hands. if(prob(S.tool_quality(tool)) && do_mob(user, M, rand(S.min_duration, S.max_duration)) && ((user.mind.isSurgeon) || (!user.mind.isSurgeon) && (prob(50))) && (!user.fail_next_op)) //if they aren't a surgeon, give them a 50% chance of succeeding S.end_step(user, M, zone, tool) //finish successfully - else if ((tool in user.contents) && user.Adjacent(M) || ((!user.mind.isSurgeon) && (prob(50))) || (user.fail_next_op)) //otherwise, fail the step + else if ((tool in user.contents) && user.Adjacent(M) || ((!user.mind.isSurgeon) && (prob(50))) || (user.fail_next_op)) //otherwise, fail the step. Also note, this is a bloody mess of brackets, and I have no idea if it works or not. S.fail_step(user, M, zone, tool) //malpractice~ else // This failing silently was a pain. user << "\red You must remain close to your patient to conduct surgery." From d6d06e4a0fc2f7b13d3868f9ad406c66fe57f6c6 Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Mon, 31 Aug 2015 14:10:50 +0100 Subject: [PATCH 09/11] Gave the ERT isSurgeon --- code/game/antagonist/outsider/ert.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/game/antagonist/outsider/ert.dm b/code/game/antagonist/outsider/ert.dm index d847d4ef7a84c..cf391ad34377e 100644 --- a/code/game/antagonist/outsider/ert.dm +++ b/code/game/antagonist/outsider/ert.dm @@ -29,6 +29,7 @@ var/datum/antagonist/ert/ert player.current << "You should first gear up and discuss a plan with your team. More members may be joining, don't move out before you're ready." /datum/antagonist/ert/equip(var/mob/living/carbon/human/player) + var/mob/living/M = player //Special radio setup player.equip_to_slot_or_del(new /obj/item/device/radio/headset/ert(src), slot_l_ear) @@ -41,5 +42,6 @@ var/datum/antagonist/ert/ert W.registered_name = player.real_name W.name = "[player.real_name]'s ID Card ([W.assignment])" player.equip_to_slot_or_del(W, slot_wear_id) + M.mind.isSurgeon = 1 return 1 From ea56783e7c41cde41973ebdbc54af4f098b11e14 Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Mon, 31 Aug 2015 14:12:04 +0100 Subject: [PATCH 10/11] Gave mercenaries isSurgeon --- code/game/antagonist/outsider/mercenary.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/game/antagonist/outsider/mercenary.dm b/code/game/antagonist/outsider/mercenary.dm index 1ddc6457d942e..c6155eeefe9f4 100644 --- a/code/game/antagonist/outsider/mercenary.dm +++ b/code/game/antagonist/outsider/mercenary.dm @@ -26,7 +26,7 @@ var/datum/antagonist/mercenary/mercs return 1 /datum/antagonist/mercenary/equip(var/mob/living/carbon/human/player) - + var/mob/living/M = player if(!..()) return 0 @@ -39,6 +39,7 @@ var/datum/antagonist/mercenary/mercs player.equip_to_slot_or_del(new /obj/item/weapon/storage/box/engineer(player.back), slot_in_backpack) player.equip_to_slot_or_del(new /obj/item/weapon/reagent_containers/pill/cyanide(player), slot_in_backpack) player.update_icons() + M.mind.isSurgeon = 1 create_id("Mercenary", player) create_radio(SYND_FREQ, player) @@ -58,4 +59,4 @@ var/datum/antagonist/mercenary/mercs var/obj/effect/landmark/uplinkdevice = locate("landmark*Syndicate-Uplink") if(uplinkdevice) var/obj/item/device/radio/uplink/U = new(uplinkdevice.loc) - U.hidden_uplink.uses = 40 \ No newline at end of file + U.hidden_uplink.uses = 40 From 89b11f7aa3bdd0b6d12e2e798a8444fb87d10139 Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Tue, 1 Sep 2015 13:48:00 +0100 Subject: [PATCH 11/11] Surgeon allocation --- code/game/jobs/job_controller.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 447e82d3b641d..649f111a065c4 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -61,6 +61,8 @@ var/global/datum/controller/occupations/job_master player.mind.role_alt_title = GetPlayerAltTitle(player, rank) unassigned -= player job.current_positions++ + if((job = "Chief Medical Officer") || (job = "Medical Doctor") || (job = "Cyborg")) + player.mind.isSurgeon = 1 return 1 Debug("AR has failed, Player: [player], Rank: [rank]") return 0