Tweaks and fixes

This commit is contained in:
c0
2015-08-02 00:37:29 +03:00
parent 1c93a6e708
commit 8e0e6f3191
5 changed files with 47 additions and 103 deletions
+44 -44
View File
@@ -2,58 +2,58 @@
if(istype(M))
var/mob/living/carbon/human/H
var/obj/item/organ/limb/affecting
var/selected_zone = user.zone_sel.selecting
if(istype(M, /mob/living/carbon/human))
H = M
affecting = H.get_organ(check_zone(user.zone_sel.selecting))
affecting = H.get_organ(check_zone(selected_zone))
if(M.lying || isslime(M)) //if they're prone or a slime
var/list/all_surgeries = surgeries_list.Copy()
var/list/available_surgeries = list()
for(var/i in all_surgeries)
var/datum/surgery/S = all_surgeries[i]
if(!S.possible_locs.Find(user.zone_sel.selecting))
continue
if(locate(S.type) in M.surgeries)
continue
if(affecting && S.requires_organic_bodypart && affecting.status == ORGAN_ROBOTIC)
continue
if(!S.can_start(user, M))
continue
for(var/path in S.species)
if(istype(M, path))
available_surgeries[S.name] = S
break
var/datum/surgery/current_surgery
for(var/datum/surgery/S in M.surgeries)
if(S.status == 1 && !S.step_in_progress)
available_surgeries["cancel " + S.name] = S
if(S.location == selected_zone)
current_surgery = S
var/P = input("Begin which procedure?", "Surgery", null, null) as null|anything in available_surgeries
if(P)
var/datum/surgery/S = available_surgeries[P]
if(S in M.surgeries)
M.surgeries -= S
qdel(S)
return 1
if(!current_surgery)
var/list/all_surgeries = surgeries_list.Copy()
var/list/available_surgeries = list()
for(var/i in all_surgeries)
var/datum/surgery/S = all_surgeries[i]
if(!S.possible_locs.Find(selected_zone))
continue
if(affecting && S.requires_organic_bodypart && affecting.status == ORGAN_ROBOTIC)
continue
if(!S.can_start(user, M))
continue
var/datum/surgery/procedure = new S.type
if(procedure)
procedure.location = user.zone_sel.selecting
if(procedure.ignore_clothes || get_location_accessible(M, procedure.location))
M.surgeries += procedure
if(affecting)
for(var/path in S.species)
if(istype(M, path))
available_surgeries[S.name] = S
break
var/P = input("Begin which procedure?", "Surgery", null, null) as null|anything in available_surgeries
if(P && user.Adjacent(M) && (I in user))
var/datum/surgery/S = available_surgeries[P]
var/datum/surgery/procedure = new S.type
if(procedure)
procedure.location = selected_zone
if(procedure.ignore_clothes || get_location_accessible(M, selected_zone))
M.surgeries += procedure
procedure.organ = affecting
user.visible_message("[user] drapes [I] over [M]'s [parse_zone(procedure.location)] to prepare for \an [procedure.name].", \
"<span class='notice'>You drape [I] over [M]'s [parse_zone(procedure.location)] to prepare for \an [procedure.name].</span>")
user.visible_message("[user] drapes [I] over [M]'s [parse_zone(selected_zone)] to prepare for \an [procedure.name].", \
"<span class='notice'>You drape [I] over [M]'s [parse_zone(selected_zone)] to prepare for \an [procedure.name].</span>")
add_logs(user, M, "operated", addition="Operation type: [procedure.name]")
return 1
else
user << "<span class='warning'>You need to expose [M]'s [procedure.location] first!</span>"
return 1 //return 1 so we don't slap the guy in the dick with the drapes.
else
return 1 //once the input menu comes up, cancelling it shouldn't hit the guy with the drapes either.
add_logs(user, M, "operated", addition="Operation type: [procedure.name], location: [selected_zone]")
else
user << "<span class='warning'>You need to expose [M]'s [parse_zone(selected_zone)] first!</span>"
else if(current_surgery.status == 1 && !current_surgery.step_in_progress)
M.surgeries -= current_surgery
user.visible_message("[user] removes the drapes from [M]'s [parse_zone(selected_zone)].", \
"<span class='notice'>You remove the drapes from [M]'s [parse_zone(selected_zone)].</span>")
qdel(current_surgery)
return 1
return 0
@@ -79,13 +79,13 @@ proc/get_location_modifier(mob/M)
for(var/obj/item/clothing/I in list(C.back, C.wear_mask, C.head))
covered_locations |= I.body_parts_covered
face_covered |= I.flags_inv
eyesmouth_covered |= I.flags
eyesmouth_covered |= I.flags_cover
if(ishuman(C))
var/mob/living/carbon/human/H = C
for(var/obj/item/I in list(H.wear_suit, H.w_uniform, H.shoes, H.belt, H.gloves, H.glasses, H.ears))
covered_locations |= I.body_parts_covered
face_covered |= I.flags_inv
eyesmouth_covered |= I.flags
eyesmouth_covered |= I.flags_cover
switch(location)
if("head")
@@ -1,54 +0,0 @@
/*
//CONTENTS//
Multiple location example surgery
//THE SURGERY//
it is very similar to a normal surgery.
Location = "anywhere" is the unique difference.
/datum/surgery/multiLocExample
name = "Multiple Location Surgery Example"
steps = list(/datum/surgery_step/multiLocExampleStep)
species = list(/mob/living/carbon)
location = "anywhere" //A Location "Anywhere" is handled in /code/modules/surgery/helpers attempt_initiate_surgery(), it is converted into a User.zone_sel.selecting.
has_multi_loc = 1 //Needed to handle Multilocation
//THE STEPS//
The block of "If's" is necessary, add or remove so you have just the areas you want, and set them to convert L(or your subsitute) to what you want it to be
EG: a zone on a mob (where user is targetting) to the limb thats actually there.
/datum/surgery_step/multiLocExampleStep
implements = list()
time = 9001
allowed_organs = list("r_arm","l_arm","r_leg","l_leg","chest","head", "etc")
// allowed_organs is a list of organs this operation works with, it is defined in the earliest instance of the surgery_step (Eg, datum/surgery_step/multiLocExampleStep)
// allowed_organs is handled in Handle_Multi_Loc() in surgery_step.dm
/datum/surgery_step/multiLocExampleStep/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
L = new_organ //new_organ is a variable in /datum/surgery_step, it is null by default, and is given a value in Handle_Multi_Loc()
//Although Handle_Multi_Loc() is /datum/surgery_step/SURGERYNAME/Handle_Multi_Loc() you do not need to rewrite it in the surgery
if(L)
user.visible_message("<span class ='notice'>Generic Statement.</span>")
else
user.visible_message("<span class ='notice'>Generic Statement 2.</span>")
/datum/surgery_step/multiLocExampleStep/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
You can use whatever you substituted "L" for here for useful things, swapping limbs for other limbs, etc.
if the surgery is intended to be MultiLoc but should only be performable once per limb, add this
"surgery.invalid_locations += user.zone_sel.selecting"
Just after you have swapped limbs around, see limb augmentation for an example of this
*/
//This file is commented out as to avoid:
// a snowflakey removal of it 100% of the time
// it's an example, it doesn't work perfectly due to just being the multiple locations section.
// It is also not set to compile, due to being Empty (according to the compiler)
//Enjoy making Multi-location operations! (if you understood my Rambling)
//If you didn't understand this, Ask for RobRichards in Coderbus