Patch rework (#13062)

* Patch Rework Part 1

* applicator

* fixes

* fixes

* temperature settings

* single application patches

* additional

* new line fix

* fox  is a derp sometimes
This commit is contained in:
Fox McCloud
2020-05-02 20:07:43 -04:00
committed by GitHub
parent 4118b4c8f9
commit faecf7cbfa
26 changed files with 297 additions and 118 deletions
@@ -0,0 +1,106 @@
/obj/item/reagent_containers/applicator
name = "auto-mender"
desc = "A small electronic device designed to topically apply healing chemicals."
icon = 'icons/goonstation/objects/objects.dmi'
icon_state = "mender"
item_state = "mender"
volume = 200
resistance_flags = ACID_PROOF
container_type = REFILLABLE | AMOUNT_VISIBLE
temperature_min = 270
temperature_max = 350
var/ignore_flags = FALSE
var/emagged = FALSE
var/applied_amount = 8 // How much it applies
var/applying = FALSE // So it can't be spammed.
var/measured_health = 0 // Used for measuring health; we don't want this to stop applying once the person's health isn't changing.
/obj/item/reagent_containers/applicator/emag_act(mob/user)
if(!emagged)
emagged = TRUE
ignore_flags = TRUE
to_chat(user, "<span class='warning'>You short out the safeties on [src].</span>")
/obj/item/reagent_containers/applicator/on_reagent_change()
if(!emagged)
var/found_forbidden_reagent = FALSE
for(var/datum/reagent/R in reagents.reagent_list)
if(!GLOB.safe_chem_applicator_list.Find(R.id))
reagents.del_reagent(R.id)
found_forbidden_reagent = TRUE
if(found_forbidden_reagent)
if(ismob(loc))
to_chat(loc, "<span class='warning'>[src] identifies and removes a harmful substance.</span>")
else
visible_message("<span class='warning'>[src] identifies and removes a harmful substance.</span>")
update_icon()
/obj/item/reagent_containers/applicator/update_icon()
cut_overlays()
if(reagents.total_volume)
var/mutable_appearance/filling = mutable_appearance('icons/goonstation/objects/objects.dmi', "mender-fluid")
filling.color = mix_color_from_reagents(reagents.reagent_list)
add_overlay(filling)
/obj/item/reagent_containers/applicator/attack(mob/living/M, mob/user)
if(!reagents.total_volume)
to_chat(user, "<span class='warning'>[src] is empty!</span>")
return
if(applying)
to_chat(user, "<span class='warning'>You're already applying [src].</span>")
return
if(!iscarbon(M))
return
if(ignore_flags || M.can_inject(user, TRUE))
if(M == user)
M.visible_message("[user] begins mending [user.p_them()]self with [src].", "<span class='notice'>You begin mending yourself with [src].</span>")
else
user.visible_message("<span class='warning'>[user] begins mending [M] with [src].</span>", "<span class='notice'>You begin mending [M] with [src].</span>")
if(M.reagents)
applying = TRUE
icon_state = "mender-active"
apply_to(M, user, 0.2) // We apply a very weak application up front, then loop.
while(do_after(user, 10, target = M))
measured_health = M.health
apply_to(M, user, 1, FALSE)
if((measured_health == M.health) || !reagents.total_volume)
to_chat(user, "<span class='notice'>[M] is finished healing and [src] powers down automatically.</span>")
break
applying = FALSE
icon_state = "mender"
user.changeNext_move(CLICK_CD_MELEE)
/obj/item/reagent_containers/applicator/proc/apply_to(mob/living/carbon/M, mob/user, multiplier = 1, show_message = TRUE)
var/total_applied_amount = applied_amount * multiplier
if(reagents && reagents.total_volume)
var/list/injected = list()
for(var/datum/reagent/R in reagents.reagent_list)
injected += R.name
var/contained = english_list(injected)
add_attack_logs(user, M, "Automends with [src] containing ([contained])", reagents.harmless_helper() ? ATKLOG_ALMOSTALL : null)
var/fractional_applied_amount = total_applied_amount / reagents.total_volume
reagents.reaction(M, REAGENT_TOUCH, fractional_applied_amount, show_message)
reagents.trans_to(M, total_applied_amount * 0.5)
reagents.remove_any(total_applied_amount * 0.5)
playsound(get_turf(src), pick('sound/goonstation/items/mender.ogg', 'sound/goonstation/items/mender2.ogg'), 50, 1)
/obj/item/reagent_containers/applicator/brute
name = "brute auto-mender"
list_reagents = list("styptic_powder" = 200)
/obj/item/reagent_containers/applicator/burn
name = "burn auto-mender"
list_reagents = list("silver_sulfadiazine" = 200)
/obj/item/reagent_containers/applicator/dual
name = "dual auto-mender"
list_reagents = list("synthflesh" = 200)
@@ -5,10 +5,24 @@
icon_state = "bandaid"
item_state = "bandaid"
possible_transfer_amounts = null
volume = 40
volume = 30
apply_type = REAGENT_TOUCH
apply_method = "apply"
transfer_efficiency = 0.5 //patches aren't as effective at getting chemicals into the bloodstream.
temperature_min = 270
temperature_max = 350
var/needs_to_apply_reagents = TRUE
/obj/item/reagent_containers/food/pill/patch/attack(mob/living/carbon/M, mob/user, def_zone)
if(!istype(M))
return FALSE
bitesize = 0
if(M.eat(src, user))
user.drop_item()
forceMove(M)
M.processing_patches += src
return TRUE
return FALSE
/obj/item/reagent_containers/food/pill/patch/afterattack(obj/target, mob/user , proximity)
return // thanks inheritance again
@@ -18,29 +32,37 @@
desc = "Helps with brute injuries."
icon_state = "bandaid_brute"
instant_application = 1
list_reagents = list("styptic_powder" = 40)
list_reagents = list("styptic_powder" = 30)
/obj/item/reagent_containers/food/pill/patch/styptic/small
name = "healing mini-patch"
list_reagents = list("styptic_powder" = 15)
/obj/item/reagent_containers/food/pill/patch/silver_sulf
name = "burn patch"
desc = "Helps with burn injuries."
icon_state = "bandaid_burn"
instant_application = 1
list_reagents = list("silver_sulfadiazine" = 40)
list_reagents = list("silver_sulfadiazine" = 30)
/obj/item/reagent_containers/food/pill/patch/silver_sulf/small
name = "burn mini-patch"
list_reagents = list("silver_sulfadiazine" = 15)
/obj/item/reagent_containers/food/pill/patch/synthflesh
name = "synthflesh patch"
desc = "Helps with brute and burn injuries."
icon_state = "bandaid_med"
instant_application = 1
list_reagents = list("synthflesh" = 20)
list_reagents = list("synthflesh" = 10)
/obj/item/reagent_containers/food/pill/patch/nicotine
name = "nicotine patch"
desc = "Helps temporarily curb the cravings of nicotine dependency."
list_reagents = list("nicotine" = 20)
list_reagents = list("nicotine" = 10)
/obj/item/reagent_containers/food/pill/patch/jestosterone
name = "jestosterone patch"
desc = "Helps with brute injuries if the affected person is a clown, otherwise inflicts various annoying effects."
icon_state = "bandaid_clown"
list_reagents = list("jestosterone" = 30)
list_reagents = list("jestosterone" = 20)