Files
Paradise/code/modules/paperwork/pen.dm
Luc 346a1b8142 Yet Another Surgery Refactor (#18325)
* Initial commit

Fixes up surgery.dm
Adds some tool behavior

* More basic changes

* Checkpointing: this is a little gross right now

* Add signal COMPONENT_CANCEL_ATTACK_CHAIN

* Cleans up surgery initiator

* Mostly gets surgery (and canceling it) working

* Add abstract proxy surgery steps

Also adds them to organ manipulation

* Clean up most existing surgeries

* Rework organ openness, adds define for aborting a beginstep

* surgery works again, also implements retry defines

* fix surgery computer

* add limb repair to synth implant removal

* retry implant checks

* Clean up abductor surgeries as well as some other things

* A lot
- Reworks organ manipulation to use a series of surgery steps instead
- Fixes some runtimes with open hands
- Lets mito zero out the germ level while treating necrosis
- Adds a debug surgery tool

* add debug surgery tool, note some TODOs for later

* Add conditional check for surgeries repeating

* update surgery retry logic to make it more of a bonus

* Lets abductors automatically retry any failed surgery steps

* Rework robotic surgery to use abstract/proxy steps

* Bunch of bugfixes and more!
- Limb reattachment works properly now, you can just slap a limb onto a person
- If the limb isn't robotic, it'll be useless until the surgery is finished with a hemostat, though it might be enough to get the patient out of the OR.

* Remove more now-implicit checks

* Slight reorganization

* more fixes across the board

* Remove unused variable

* Trying not to lose my mind here
- Does away with can_run() entirely
- Cleans up visible messages in code
- begin steps should now all have ..() afterwards
- slime bone surgery should be fixed now
- more docs

* Robotic  surgery is stoppable with a crowbar, all surgery can_start now checks parent

* Fix some broken robotic typepaths

* Typepath fixes, do away with some last TODOs

* Forgor

* Last cleanups before we go gold

* jk lol

* Make early surgery termination clearer

* More "last" cleanups

* Fixes tool flags, surgery initiation

- Fixes surgery not being startable by sharp objects
- Moves surgical tool flags to item traits

* Clean up surgery cancellation, especially for borgos

* I think this should GC better

* Apply suggestions from code review

Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>

* Status is now step number

* Add a 20% chance to find nothing during organ manipulation

* Improve documentation, make forced_surgery a normal arg

* Charlie's reviews

* Why are abductors like this

* Little more verification, ensuring limb augmentation and organ manip healing work properly

* Fix torso organ manip being unfinishable

* Fix cavity implants, open-hand/any item steps

* Make sharp objects not try to start an operation with help intent

* Comments, quick target fix

* Re-order list so advanced bruise pack is pulled first

* Make surgical gripper function like an open hand

* Make mito only use one unit per organ for now

* Check if user is on operable surface before trying to operate

* Reduce admin logging

* Fix some bugs that appeared during the testmerge
- you can no longer start robotic surgeries with a scalpel (lol)
- you can now cancel surgeries on the first step after I fixed some bugs that I introduced (woo hoo)
- Synthetic limb attachment is now combined into a single startable surgery step, though still retains the fun flavor of both

* Swats some more bugs
- (hopefully) fixes a huge source of runtimes where we tried to check if we could run surgeries before checking if the surgery used an organ
- In doing so, moves the logic for determining if a surgery can start to the mob-level
- Fixes robotic reattachment surgery not working

* multi-bug drifting???

- Fixes a bug where a branching surgery with an any tool option could possibly override a step with a matching tool
- Fixes some intermediate surgeries failing due to not having specified possible_locs

* A few more fixes
- Fixes any surgery tool steps again
- Fixes cavity surgery again

* Hopefully fixes getting stuck in robotic organ manip

* Remove extra parent call

* Steel review

* Steel review

* Fix spacing for possible locs

* Roundstart traits

* Advanced surgical traits and other hal fixes

Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
2022-09-16 18:48:43 +01:00

206 lines
5.4 KiB
Plaintext

/* Pens!
* Contains:
* Pens
* Sleepy Pens
* Edaggers
*/
/*
* Pens
*/
/obj/item/pen
desc = "It's a normal black ink pen."
name = "pen"
icon = 'icons/obj/bureaucracy.dmi'
icon_state = "pen"
item_state = "pen"
slot_flags = SLOT_BELT | SLOT_EARS
throwforce = 0
w_class = WEIGHT_CLASS_TINY
throw_speed = 3
throw_range = 7
materials = list(MAT_METAL=10)
var/colour = "black" //what colour the ink is!
pressure_resistance = 2
/obj/item/pen/suicide_act(mob/user)
to_chat(viewers(user), "<span class='suicide'>[user] starts scribbling numbers over [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit sudoku.</span>")
return BRUTELOSS
/obj/item/pen/blue
name = "blue-ink pen"
desc = "It's a normal blue ink pen."
icon_state = "pen_blue"
colour = "blue"
/obj/item/pen/red
name = "red-ink pen"
desc = "It's a normal red ink pen."
icon_state = "pen_red"
colour = "red"
/obj/item/pen/gray
name = "gray-ink pen"
desc = "It's a normal gray ink pen."
colour = "gray"
/obj/item/pen/invisible
desc = "It's an invisble pen marker."
icon_state = "pen"
colour = "white"
/obj/item/pen/multi
name = "multicolor pen"
desc = "It's a cool looking pen. Lots of colors!"
// these values are for the overlay
var/list/colour_choices = list(
"black" = list(0.25, 0.25, 0.25),
"red" = list(1, 0.25, 0.25),
"green" = list(0, 1, 0),
"blue" = list(0.5, 0.5, 1),
"yellow" = list(1, 1, 0))
var/pen_colour_iconstate = "pencolor"
var/pen_colour_shift = 3
/obj/item/pen/multi/Initialize(mapload)
..()
update_icon()
/obj/item/pen/multi/proc/select_colour(mob/user as mob)
var/newcolour = input(user, "Which colour would you like to use?", name, colour) as null|anything in colour_choices
if(newcolour)
colour = newcolour
playsound(loc, 'sound/effects/pop.ogg', 50, 1)
update_icon()
/obj/item/pen/multi/attack_self(mob/living/user as mob)
select_colour(user)
/obj/item/pen/multi/update_overlays()
. = ..()
var/icon/colour_overlay = new(icon, pen_colour_iconstate)
var/list/colours = colour_choices[colour]
colour_overlay.SetIntensity(colours[1], colours[2], colours[3])
if(pen_colour_shift)
colour_overlay.Shift(SOUTH, pen_colour_shift)
. += colour_overlay
/obj/item/pen/fancy
name = "fancy pen"
desc = "A fancy metal pen. It uses blue ink. An inscription on one side reads,\"L.L. - L.R.\""
icon_state = "fancypen"
/obj/item/pen/multi/gold
name = "Gilded Pen"
desc = "A golden pen that is gilded with a meager amount of gold material. The word 'Nanotrasen' is etched on the clip of the pen."
icon_state = "goldpen"
pen_colour_shift = 0
/obj/item/pen/multi/fountain
name = "Engraved Fountain Pen"
desc = "An expensive looking pen."
icon_state = "fountainpen"
pen_colour_shift = 0
/*
* Sleepypens
*/
/obj/item/pen/sleepy
container_type = OPENCONTAINER
origin_tech = "engineering=4;syndicate=2"
/obj/item/pen/sleepy/attack(mob/living/M, mob/user)
if(!istype(M))
return
if(!M.can_inject(user, TRUE))
return
var/transfered = 0
var/contained = list()
for(var/R in reagents.reagent_list)
var/datum/reagent/reagent = R
contained += "[round(reagent.volume, 0.01)]u [reagent]"
if(reagents.total_volume && M.reagents)
transfered = reagents.trans_to(M, 50)
to_chat(user, "<span class='warning'>You sneakily stab [M] with the pen.</span>")
add_attack_logs(user, M, "Stabbed with (sleepy) [src]. [transfered]u of reagents transfered from pen containing [english_list(contained)].")
return TRUE
/obj/item/pen/sleepy/Initialize(mapload)
. = ..()
create_reagents(100)
reagents.add_reagent("ketamine", 100)
/*
* (Alan) Edaggers
*/
/obj/item/pen/edagger
origin_tech = "combat=3;syndicate=1"
var/on = FALSE
var/brightness_on = 2
light_color = LIGHT_COLOR_RED
armour_penetration_flat = 20
/obj/item/pen/edagger/attack_self(mob/living/user)
if(on)
on = FALSE
force = initial(force)
w_class = initial(w_class)
name = initial(name)
attack_verb = list()
hitsound = initial(hitsound)
embed_chance = initial(embed_chance)
throwforce = initial(throwforce)
playsound(user, 'sound/weapons/saberoff.ogg', 5, 1)
to_chat(user, "<span class='warning'>[src] can now be concealed.</span>")
set_light(0)
else
on = TRUE
force = 18
w_class = WEIGHT_CLASS_NORMAL
name = "energy dagger"
attack_verb = list("slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
hitsound = 'sound/weapons/blade1.ogg'
embed_chance = 100 //rule of cool
throwforce = 35
playsound(user, 'sound/weapons/saberon.ogg', 5, 1)
to_chat(user, "<span class='warning'>[src] is now active.</span>")
set_light(brightness_on, 1)
set_sharpness(on)
update_icon()
/obj/item/pen/edagger/update_icon_state()
if(on)
icon_state = "edagger"
item_state = "edagger"
else
icon_state = initial(icon_state) //looks like a normal pen when off.
item_state = initial(item_state)
/obj/item/proc/on_write(obj/item/paper/P, mob/user)
return
/obj/item/pen/poison
var/uses_left = 3
/obj/item/pen/poison/on_write(obj/item/paper/P, mob/user)
if(P.contact_poison_volume)
to_chat(user, "<span class='warning'>[P] is already coated.</span>")
else if(uses_left)
uses_left--
P.contact_poison = "amanitin"
P.contact_poison_volume = 15
P.contact_poison_poisoner = user.name
add_attack_logs(user, P, "Poison pen'ed")
to_chat(user, "<span class='warning'>You apply the poison to [P].</span>")
else
to_chat(user, "<span class='warning'>[src] clicks. It seems to be depleted.</span>")