mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
a590870d00
* Monke Mode * Punch * Some comment stuff * Linters, excess * Linters * Emote stuff * Pause monkey AI during do afters * Small improvements * Oops * Fixes monkeys trying to drink forever from a glass * Knockdowns and stamcrit fixes * Removes eating/drinking from Pun Pun * Monkey controller improvement, bug fix * Fixes monkey item giving * Fixes brain swaps * Fixes * Update code/datums/ai/monkey/monkey_controller.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> * Addresses code review * Oops * Oops round 2 * Fixes monkeys staying in trip mode when evolved --------- Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
325 lines
10 KiB
Plaintext
325 lines
10 KiB
Plaintext
/obj/item/reagent_containers/syringe
|
|
name = "syringe"
|
|
desc = "A syringe."
|
|
icon = 'icons/goonstation/objects/syringe.dmi'
|
|
icon_state = "0"
|
|
inhand_icon_state = "syringe_0"
|
|
belt_icon = "syringe"
|
|
possible_transfer_amounts = null
|
|
volume = 15
|
|
var/busy = FALSE
|
|
var/mode = SYRINGE_DRAW
|
|
var/projectile_type = /obj/projectile/bullet/dart/syringe
|
|
materials = list(MAT_METAL=10, MAT_GLASS=20)
|
|
container_type = TRANSPARENT
|
|
///If this variable is true, the syringe will work through hardsuits / modsuits / biosuits.
|
|
var/penetrates_thick = FALSE
|
|
var/syringe_draw_time = 3 SECONDS
|
|
|
|
/obj/item/reagent_containers/syringe/Initialize(mapload)
|
|
. = ..()
|
|
if(list_reagents) //syringe starts in inject mode if its already got something inside
|
|
mode = SYRINGE_INJECT
|
|
update_icon()
|
|
|
|
var/static/list/loc_connections = list(
|
|
COMSIG_ATOM_ENTERED = PROC_REF(on_atom_entered),
|
|
)
|
|
AddElement(/datum/element/connect_loc, loc_connections)
|
|
|
|
/obj/item/reagent_containers/syringe/on_reagent_change()
|
|
update_icon()
|
|
|
|
/obj/item/reagent_containers/syringe/pickup(mob/user)
|
|
. = ..()
|
|
update_icon()
|
|
|
|
/obj/item/reagent_containers/syringe/dropped(mob/user)
|
|
..()
|
|
update_icon()
|
|
|
|
/obj/item/reagent_containers/syringe/activate_self(mob/user)
|
|
if(..())
|
|
return
|
|
|
|
mode = !mode
|
|
update_icon()
|
|
|
|
/obj/item/reagent_containers/syringe/attack_hand()
|
|
..()
|
|
update_icon()
|
|
|
|
/obj/item/reagent_containers/syringe/proc/mob_inject(mob/living/L, mob/living/user)
|
|
. = FALSE
|
|
|
|
if(!reagents.total_volume)
|
|
to_chat(user, SPAN_NOTICE("[src] is empty."))
|
|
return
|
|
|
|
if(L.reagents.total_volume >= L.reagents.maximum_volume)
|
|
to_chat(user, SPAN_NOTICE("[L] is full."))
|
|
return
|
|
|
|
if(L) //living mob
|
|
if(!L.can_inject(user, TRUE, penetrate_thick = penetrates_thick))
|
|
return
|
|
if(L != user)
|
|
L.visible_message(SPAN_DANGER("[user] is trying to inject [L]!"), \
|
|
SPAN_USERDANGER("[user] is trying to inject you!"))
|
|
SEND_SIGNAL(L, COMSIG_LIVING_TRY_SYRINGE_INJECT, user)
|
|
if(!do_mob(user, L))
|
|
return
|
|
if(L.reagents.total_volume >= L.reagents.maximum_volume)
|
|
return
|
|
L.visible_message(SPAN_DANGER("[user] injects [L] with the syringe!"), \
|
|
SPAN_USERDANGER("[user] injects [L] with the syringe!"))
|
|
|
|
var/list/rinject = list()
|
|
for(var/datum/reagent/R in reagents.reagent_list)
|
|
rinject += R.name
|
|
var/contained = english_list(rinject)
|
|
|
|
add_attack_logs(user, L, "Injected with [name] containing [contained], transfered [amount_per_transfer_from_this] units", reagents.harmless_helper() ? ATKLOG_ALMOSTALL : null)
|
|
|
|
return TRUE
|
|
|
|
/obj/item/reagent_containers/syringe/proc/mob_draw(mob/living/L, mob/living/user)
|
|
. = FALSE
|
|
var/drawn_amount = reagents.maximum_volume - reagents.total_volume
|
|
if(L != user)
|
|
L.visible_message(SPAN_DANGER("[user] is trying to take a blood sample from [L]!"), \
|
|
SPAN_USERDANGER("[user] is trying to take a blood sample from [L]!"))
|
|
SEND_SIGNAL(L, COMSIG_LIVING_TRY_SYRINGE_WITHDRAW, user)
|
|
busy = TRUE
|
|
if(!do_mob(user, L, syringe_draw_time))
|
|
busy = FALSE
|
|
return
|
|
if(reagents.holder_full())
|
|
return
|
|
busy = FALSE
|
|
if(L.transfer_blood_to(src, drawn_amount))
|
|
user.visible_message(SPAN_NOTICE("[user] takes a blood sample from [L]."))
|
|
else
|
|
to_chat(user, SPAN_WARNING("You are unable to draw any blood from [L]!"))
|
|
|
|
if(reagents.holder_full())
|
|
mode = !mode
|
|
update_icon()
|
|
|
|
return TRUE
|
|
|
|
/obj/item/reagent_containers/syringe/proc/normal_draw(atom/target, mob/living/user)
|
|
. = FALSE
|
|
if(!target.reagents.total_volume)
|
|
to_chat(user, SPAN_WARNING("[target] is empty!"))
|
|
return
|
|
|
|
if(!target.is_drawable(user))
|
|
to_chat(user, SPAN_WARNING("You cannot directly remove reagents from [target]!"))
|
|
return
|
|
|
|
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this) // transfer from, transfer to - who cares?
|
|
to_chat(user, SPAN_NOTICE("You fill [src] with [trans] units of the solution. It now contains [reagents.total_volume] units."))
|
|
|
|
if(reagents.holder_full())
|
|
mode = !mode
|
|
update_icon()
|
|
|
|
return TRUE
|
|
|
|
/obj/item/reagent_containers/syringe/proc/normal_inject(atom/target, mob/living/user)
|
|
. = FALSE
|
|
|
|
if(!reagents.total_volume)
|
|
to_chat(user, SPAN_NOTICE("[src] is empty."))
|
|
return
|
|
|
|
if(!target.is_injectable(user))
|
|
to_chat(user, SPAN_WARNING("You cannot directly fill [target]!"))
|
|
return
|
|
|
|
if(isfood(target))
|
|
var/list/chemicals = list()
|
|
for(var/datum/reagent/chem in reagents.reagent_list)
|
|
chemicals += chem.name
|
|
var/contained_chemicals = english_list(chemicals)
|
|
add_attack_logs(user, target, "Injected [amount_per_transfer_from_this]u [contained_chemicals] into food item")
|
|
finish_injection(target, user)
|
|
return
|
|
|
|
return TRUE
|
|
|
|
/obj/item/reagent_containers/syringe/normal_act(atom/target, mob/living/user)
|
|
if(!target.reagents)
|
|
return FALSE
|
|
|
|
switch(mode)
|
|
if(SYRINGE_DRAW)
|
|
return normal_draw(target, user)
|
|
if(SYRINGE_INJECT)
|
|
. = normal_inject(target, user)
|
|
if(.)
|
|
finish_injection(target, user)
|
|
|
|
/obj/item/reagent_containers/syringe/mob_act(mob/target, mob/living/user)
|
|
. = FALSE
|
|
if(!target.reagents)
|
|
return
|
|
|
|
var/mob/living/L
|
|
if(isliving(target))
|
|
L = target
|
|
if(!L.can_inject(user, TRUE, penetrate_thick = penetrates_thick))
|
|
return
|
|
|
|
switch(mode)
|
|
if(SYRINGE_DRAW)
|
|
if(reagents.holder_full())
|
|
to_chat(user, SPAN_NOTICE("The syringe is full."))
|
|
return
|
|
|
|
// still one check here because we're not sure from the above logic
|
|
if(istype(L))
|
|
return mob_draw(L, user)
|
|
if(SYRINGE_INJECT)
|
|
. = mob_inject(L, user)
|
|
if(.)
|
|
finish_injection(target, user)
|
|
|
|
/obj/item/reagent_containers/syringe/proc/finish_injection(atom/target, mob/living/user)
|
|
var/fraction = min(amount_per_transfer_from_this / reagents.total_volume, 1)
|
|
reagents.reaction(target, REAGENT_INGEST, fraction)
|
|
reagents.trans_to(target, amount_per_transfer_from_this)
|
|
if(iscarbon(target))
|
|
var/mob/living/carbon/carbon_target = target
|
|
if(length(carbon_target.viruses))
|
|
AddComponent(/datum/component/viral_contamination, carbon_target.viruses)
|
|
to_chat(user, SPAN_NOTICE("You inject [amount_per_transfer_from_this] units of the solution. The syringe now contains [reagents.total_volume] units."))
|
|
if(reagents.total_volume <= 0 && mode == SYRINGE_INJECT)
|
|
mode = SYRINGE_DRAW
|
|
update_icon()
|
|
|
|
/obj/item/reagent_containers/syringe/update_icon_state()
|
|
var/rounded_vol
|
|
if(reagents && reagents.total_volume)
|
|
rounded_vol = clamp(round((reagents.total_volume / volume * 15), 5), 1, 15)
|
|
else
|
|
rounded_vol = 0
|
|
icon_state = "[rounded_vol]"
|
|
inhand_icon_state = "syringe_[rounded_vol]"
|
|
|
|
/obj/item/reagent_containers/syringe/update_overlays()
|
|
. = ..()
|
|
var/rounded_vol
|
|
if(reagents && reagents.total_volume)
|
|
rounded_vol = clamp(round((reagents.total_volume / volume * 15), 5), 1, 15)
|
|
var/image/filling_overlay = mutable_appearance('icons/obj/reagentfillings.dmi', "syringe[rounded_vol]")
|
|
filling_overlay.icon += mix_color_from_reagents(reagents.reagent_list)
|
|
. += filling_overlay
|
|
if(ismob(loc))
|
|
var/mob/M = loc
|
|
var/injoverlay
|
|
switch(mode)
|
|
if(SYRINGE_DRAW)
|
|
injoverlay = "draw"
|
|
if(SYRINGE_INJECT)
|
|
injoverlay = "inject"
|
|
. += injoverlay
|
|
M.update_inv_l_hand()
|
|
M.update_inv_r_hand()
|
|
|
|
/obj/item/reagent_containers/syringe/proc/on_atom_entered(datum/source, atom/movable/entered)
|
|
SIGNAL_HANDLER // COMSIG_ATOM_ENTERED
|
|
|
|
var/mob/living/carbon/human/H = entered
|
|
if(!istype(H) || !H.reagents || HAS_TRAIT(H, TRAIT_PIERCEIMMUNE) || ismachineperson(H))
|
|
return
|
|
|
|
if(H.floating || HAS_TRAIT(H, TRAIT_FLYING) || H.buckled)
|
|
return
|
|
|
|
if(!IS_HORIZONTAL(H) && (H.shoes || (H.wear_suit && (H.wear_suit.body_parts_covered & FEET)) || (H.w_uniform && (H.w_uniform.body_parts_covered & FEET))))
|
|
return
|
|
|
|
if(IS_HORIZONTAL(H) && ((H.wear_suit && (H.wear_suit.body_parts_covered & UPPER_TORSO)) || (H.w_uniform && (H.w_uniform.body_parts_covered & UPPER_TORSO))))
|
|
return
|
|
|
|
H.visible_message(SPAN_DANGER("[H] is injected by [src]."), \
|
|
SPAN_USERDANGER("You are injected by [src]!"))
|
|
|
|
if(IS_HORIZONTAL(H))
|
|
H.apply_damage(5, BRUTE, BODY_ZONE_CHEST)
|
|
else
|
|
H.apply_damage(5, BRUTE, pick(BODY_ZONE_PRECISE_L_FOOT, BODY_ZONE_PRECISE_R_FOOT))
|
|
|
|
if(reagents.total_volume && H.reagents.total_volume < H.reagents.maximum_volume)
|
|
var/inject_amount = reagents.total_volume
|
|
reagents.reaction(H, REAGENT_INGEST, inject_amount)
|
|
reagents.trans_to(H, inject_amount)
|
|
update_icon()
|
|
|
|
/obj/item/reagent_containers/syringe/antiviral
|
|
name = "syringe (spaceacillin)"
|
|
desc = "Contains antiviral agents."
|
|
list_reagents = list("spaceacillin" = 15)
|
|
|
|
/obj/item/reagent_containers/syringe/charcoal
|
|
name = "syringe (charcoal)"
|
|
desc = "Contains charcoal - used to treat toxins and damage from toxins."
|
|
list_reagents = list("charcoal" = 15)
|
|
|
|
/obj/item/reagent_containers/syringe/epinephrine
|
|
name = "syringe (Epinephrine)"
|
|
desc = "Contains epinephrine - used to stabilize patients."
|
|
list_reagents = list("epinephrine" = 15)
|
|
|
|
/obj/item/reagent_containers/syringe/insulin
|
|
name = "syringe (insulin)"
|
|
desc = "Contains insulin - used to treat diabetes."
|
|
list_reagents = list("insulin" = 15)
|
|
|
|
/obj/item/reagent_containers/syringe/calomel
|
|
name = "syringe (calomel)"
|
|
desc = "Contains calomel, which be used to purge impurities, but is highly toxic itself."
|
|
list_reagents = list("calomel" = 15)
|
|
|
|
/obj/item/reagent_containers/syringe/heparin
|
|
name = "syringe (heparin)"
|
|
desc = "Contains heparin, a blood anticoagulant."
|
|
list_reagents = list("heparin" = 15)
|
|
|
|
/obj/item/reagent_containers/syringe/bioterror
|
|
name = "bioterror syringe"
|
|
desc = "Contains several paralyzing reagents."
|
|
list_reagents = list("neurotoxin" = 5, "capulettium_plus" = 5, "sodium_thiopental" = 5)
|
|
|
|
/obj/item/reagent_containers/syringe/gluttony
|
|
name = "Gluttony's Blessing"
|
|
desc = "A syringe recovered from a dread place. It probably isn't wise to use."
|
|
amount_per_transfer_from_this = 1
|
|
volume = 1
|
|
list_reagents = list("gluttonytoxin" = 1)
|
|
|
|
/obj/item/reagent_containers/syringe/capulettium_plus
|
|
name = "capulettium plus syringe"
|
|
desc = "For silencing targets. Allows for fake deaths."
|
|
list_reagents = list("capulettium_plus" = 15)
|
|
|
|
/obj/item/reagent_containers/syringe/sarin
|
|
name = "sarin syringe"
|
|
desc = "A deadly neurotoxin, for killing."
|
|
list_reagents = list("sarin" = 15)
|
|
|
|
/obj/item/reagent_containers/syringe/pancuronium
|
|
name = "pancuronium syringe"
|
|
desc = "A powerful paralyzing poison."
|
|
list_reagents = list("pancuronium" = 15)
|
|
|
|
/obj/item/reagent_containers/syringe/lethal
|
|
name = "lethal injection syringe"
|
|
desc = "A syringe used for lethal injections. It can hold up to 50 units."
|
|
amount_per_transfer_from_this = 50
|
|
volume = 50
|
|
list_reagents = list("toxin" = 15, "pancuronium" = 10, "cyanide" = 5, "facid" = 10, "fluorine" = 10)
|
|
|