Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metaless surgery, realistic fail conditions, and harsher consequences #70

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
var/memory

var/assigned_role
var/isSurgeon = 0 //Stored in Mind for convenience
var/special_role

var/role_alt_title
Expand Down
2 changes: 2 additions & 0 deletions code/game/antagonist/outsider/ert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, but from my experience, it doesn't seem to work unless you define that. I'm not really focusing on this project at the moment, anyway - MFCS is my main project.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be, not in this case.

var/player is already mob/living/carbon/human, which is a child of mob/living (var/M), as such, it already has all of the variables inherited from var/M. Was var/player defined as mob/living, and var/M defined as mob/living/carbon/human, then it would be necessary.


//Special radio setup
player.equip_to_slot_or_del(new /obj/item/device/radio/headset/ert(src), slot_l_ear)
Expand All @@ -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
5 changes: 3 additions & 2 deletions code/game/antagonist/outsider/mercenary.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand All @@ -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
U.hidden_uplink.uses = 40
2 changes: 2 additions & 0 deletions code/game/jobs/job_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -466,6 +469,7 @@ default behaviour is:
return

/mob/living/Move(a, b, flag)
src.failop()
if (buckled)
return

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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("<B>[src] scrambles into the ventillation ducts!</B>"), 1)
loc = target_vent
Expand Down
8 changes: 6 additions & 2 deletions code/modules/mob/living/living_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -92,7 +93,8 @@
apply_effect(EYE_BLUR, agony_amount/10)

/mob/living/proc/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0)
return 0 //only carbon liveforms have this proc
failop()
return 0 //only carbon liveforms have this proc

/mob/living/emp_act(severity)
var/list/L = src.get_contents()
Expand All @@ -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")

Expand Down Expand Up @@ -236,6 +239,7 @@
location.hotspot_expose(fire_burn_temperature(), 50, 1)

/mob/living/fire_act()
failop()
adjust_fire_stacks(2)
IgniteMob()

Expand All @@ -251,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()
Expand Down
4 changes: 3 additions & 1 deletion code/modules/mob/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions code/modules/surgery/surgery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -94,17 +94,19 @@ 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)))
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That !user.mind.isSurgeon is completely redundant. (A || !A && B) is equals to just A || B.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...Oh. I'll adjust that.

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))) || (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."
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()
Expand Down