mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-14 20:23:26 +00:00
Merge pull request #2694 from Anewbe/surgery_fix
Fixes some surgery bugs
This commit is contained in:
@@ -39,8 +39,11 @@ avoid code duplication. This includes items that may sometimes act as a standard
|
||||
/mob/living/attackby(obj/item/I, mob/user)
|
||||
if(!ismob(user))
|
||||
return 0
|
||||
if(can_operate(src) && I.do_surgery(src,user)) //Surgery
|
||||
return 1
|
||||
if(can_operate(src) && I.do_surgery(src,user))
|
||||
if(I.can_do_surgery(src,user))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
return I.attack(src, user, user.zone_sel.selecting)
|
||||
|
||||
// Proximity_flag is 1 if this afterattack was called on something adjacent, in your square, or on your person.
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
/datum/surgery_step/face
|
||||
priority = 2
|
||||
req_open = 0
|
||||
can_infect = 0
|
||||
can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
|
||||
if (!hasorgans(target))
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
/obj/item/weapon/melee/energy/sword = 5
|
||||
)
|
||||
priority = 2
|
||||
req_open = 0
|
||||
min_duration = 90
|
||||
max_duration = 110
|
||||
|
||||
@@ -67,6 +68,7 @@
|
||||
/obj/item/weapon/scalpel/manager = 100
|
||||
)
|
||||
priority = 2
|
||||
req_open = 0
|
||||
min_duration = 80
|
||||
max_duration = 120
|
||||
|
||||
@@ -108,6 +110,7 @@
|
||||
/obj/item/weapon/material/knife = 75, \
|
||||
/obj/item/weapon/material/shard = 50, \
|
||||
)
|
||||
req_open = 0
|
||||
|
||||
min_duration = 90
|
||||
max_duration = 110
|
||||
@@ -273,6 +276,7 @@
|
||||
/obj/item/weapon/circular_saw = 100, \
|
||||
/obj/item/weapon/material/hatchet = 75
|
||||
)
|
||||
req_open = 0
|
||||
|
||||
min_duration = 110
|
||||
max_duration = 160
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
/datum/surgery_step/limb/
|
||||
priority = 3 // Must be higher than /datum/surgery_step/internal
|
||||
req_open = 0
|
||||
can_infect = 0
|
||||
can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
|
||||
if (!hasorgans(target))
|
||||
|
||||
@@ -175,6 +175,7 @@
|
||||
/obj/item/weapon/circular_saw = 60,
|
||||
/obj/item/weapon/pickaxe/plasmacutter = 100
|
||||
)
|
||||
req_open = 0
|
||||
|
||||
can_infect = 0
|
||||
blood_level = 0
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
/obj/item/weapon/coin = 50,
|
||||
/obj/item/weapon/material/kitchen/utensil/knife = 50
|
||||
)
|
||||
req_open = 0
|
||||
|
||||
min_duration = 90
|
||||
max_duration = 110
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/datum/surgery_step
|
||||
var/priority = 0 //steps with higher priority would be attempted first
|
||||
|
||||
var/req_open = 1 //1 means the part must be cut open, 0 means it doesn't
|
||||
|
||||
// type path referencing tools that can be used for this step, and how well are they suited for it
|
||||
var/list/allowed_tools = null
|
||||
// type paths referencing races that this step applies to.
|
||||
@@ -77,6 +79,20 @@
|
||||
|
||||
E.germ_level = max(germ_level,E.germ_level) //as funny as scrubbing microbes out with clean gloves is - no.
|
||||
|
||||
|
||||
/obj/item/proc/can_do_surgery(mob/living/carbon/M, mob/living/user)
|
||||
if(M == user)
|
||||
return 0
|
||||
if(!ishuman(M))
|
||||
return 1
|
||||
var/mob/living/carbon/human/H = M
|
||||
var/obj/item/organ/external/affected = H.get_organ(user.zone_sel.selecting)
|
||||
if(affected)
|
||||
for(var/datum/surgery_step/S in surgery_steps)
|
||||
if(!affected.open && S.req_open)
|
||||
return 0
|
||||
return 0
|
||||
|
||||
/obj/item/proc/do_surgery(mob/living/carbon/M, mob/living/user)
|
||||
if(!istype(M))
|
||||
return 0
|
||||
@@ -109,7 +125,7 @@
|
||||
return 1 //don't want to do weapony things after surgery
|
||||
|
||||
if (user.a_intent == I_HELP)
|
||||
user << "<span class='warning'>You can't see any useful way to use [src] on [M].</span>"
|
||||
user << "<span class='warning'>You can't see any surgical way to use [src] on [M].</span>"
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user