mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-27 18:42:19 +00:00
Self-Surgery (#7671)
* Allows organics to self-surgery after standing still for 5 seconds. It follows the same rules as normal surgery. * Confirm-by-delay for self-surgery steps. * Verb to toggle self-surgery. * Add log.
This commit is contained in:
@@ -52,6 +52,8 @@
|
||||
dna.real_name = real_name
|
||||
sync_organ_dna()
|
||||
|
||||
verbs |= /mob/living/proc/toggle_selfsurgery
|
||||
|
||||
/mob/living/carbon/human/Destroy()
|
||||
human_mob_list -= src
|
||||
for(var/organ in organs)
|
||||
|
||||
@@ -70,4 +70,7 @@
|
||||
var/makes_dirt = TRUE //FALSE if the mob shouldn't be making dirt on the ground when it walks
|
||||
|
||||
var/looking_elsewhere = FALSE //If the mob's view has been relocated to somewhere else, like via a camera or with binocs
|
||||
|
||||
var/image/selected_image = null // Used for buildmode AI control stuff.
|
||||
|
||||
var/allow_self_surgery = FALSE // Used to determine if the mob can perform surgery on itself.
|
||||
|
||||
@@ -15,3 +15,13 @@
|
||||
layer = HIDING_LAYER //Just above cables with their 2.44
|
||||
plane = OBJ_PLANE
|
||||
to_chat(src,"<span class='notice'>You are now hiding.</span>")
|
||||
|
||||
/mob/living/proc/toggle_selfsurgery()
|
||||
set name = "Allow Self Surgery"
|
||||
set desc = "Toggles the 'safeties' on self-surgery, allowing you to do so."
|
||||
set category = "Object"
|
||||
|
||||
allow_self_surgery = !allow_self_surgery
|
||||
|
||||
to_chat(usr, "<span class='notice'>You will [allow_self_surgery ? "now" : "no longer"] attempt to operate upon yourself.</span>")
|
||||
log_admin("DEBUG \[[world.timeofday]\]: [src.ckey ? "[src.name]:([src.ckey])" : "[src.name]"] has [allow_self_surgery ? "Enabled" : "Disabled"] self surgery.")
|
||||
|
||||
@@ -121,8 +121,8 @@
|
||||
|
||||
|
||||
/obj/item/proc/can_do_surgery(mob/living/carbon/M, mob/living/user)
|
||||
if(M == user)
|
||||
return 0
|
||||
// if(M == user)
|
||||
// return 0
|
||||
if(!ishuman(M))
|
||||
return 1
|
||||
|
||||
@@ -139,11 +139,19 @@
|
||||
if(zone in M.op_stage.in_progress) //Can't operate on someone repeatedly.
|
||||
to_chat(user, "<span class='warning'>You can't operate on this area while surgery is already in progress.</span>")
|
||||
return 1
|
||||
|
||||
for(var/datum/surgery_step/S in surgery_steps)
|
||||
//check if tool is right or close enough and if this step is possible
|
||||
if(S.tool_quality(src))
|
||||
var/step_is_valid = S.can_use(user, M, zone, src)
|
||||
if(step_is_valid && S.is_valid_target(M))
|
||||
|
||||
if(M == user) // Once we determine if we can actually do a step at all, give a slight delay to self-surgery to confirm attempts.
|
||||
to_chat(user, "<span class='critical'>You focus on attempting to perform surgery upon yourself.</span>")
|
||||
|
||||
if(!do_after(user, 3 SECONDS, M))
|
||||
return 0
|
||||
|
||||
if(step_is_valid == SURGERY_FAILURE) // This is a failure that already has a message for failing.
|
||||
return 1
|
||||
M.op_stage.in_progress += zone
|
||||
@@ -155,7 +163,7 @@
|
||||
success = FALSE
|
||||
|
||||
// Bad or no surface may mean failure as well.
|
||||
var/obj/surface = M.get_surgery_surface()
|
||||
var/obj/surface = M.get_surgery_surface(user)
|
||||
if(!surface || !prob(surface.surgery_odds))
|
||||
success = FALSE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user