Skip to content

Commit

Permalink
Merge pull request #3501 from MistakeNot4892/injections
Browse files Browse the repository at this point in the history
Implements can_be_injected_by().
  • Loading branch information
out-of-phaze authored Dec 4, 2023
2 parents ffc74c6 + e4275d4 commit 3364cc4
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 22 deletions.
9 changes: 0 additions & 9 deletions code/_helpers/atom_movables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,3 @@
..()
if(density && prob(50))
do_simple_ranged_interaction()

/atom/movable/proc/can_be_injected_by(var/atom/injector)
if(!Adjacent(get_turf(injector)))
return FALSE
if(!reagents)
return FALSE
if(!REAGENTS_FREE_SPACE(reagents))
return FALSE
return TRUE
3 changes: 3 additions & 0 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -861,3 +861,6 @@

/atom/proc/get_overhead_text_y_offset()
return 0

/atom/proc/can_be_injected_by(var/atom/injector)
return FALSE
5 changes: 4 additions & 1 deletion code/game/objects/items/weapons/implants/implants/chem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,7 @@ var/global/list/chem_implants = list()

/obj/item/implantcase/chem
name = "glass case - 'chem'"
imp = /obj/item/implant/chem
imp = /obj/item/implant/chem

/obj/item/implantcase/chem/can_be_injected_by(var/atom/injector)
return FALSE
6 changes: 3 additions & 3 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@
/obj/proc/after_wounding(obj/item/organ/external/organ, datum/wound)
return

/obj/can_be_injected_by(var/atom/injector)
. = ATOM_IS_OPEN_CONTAINER(src) && ..()

/obj/get_mass()
return min(2**(w_class-1), 100)

Expand Down Expand Up @@ -339,3 +336,6 @@
matter = null
new /obj/effect/decal/cleanable/molten_item(src)
qdel(src)

/obj/can_be_injected_by(var/atom/injector)
return ATOM_IS_OPEN_CONTAINER(src)
3 changes: 3 additions & 0 deletions code/modules/clothing/masks/smokable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@
ignitermes = "<span class='notice'>USER fiddles with FLAME, and manages to light their NAME.</span>"
brand = "\improper Trans-Stellar Duty-free"

/obj/item/clothing/mask/smokable/cigarette/can_be_injected_by(var/atom/injector)
return TRUE

/obj/item/clothing/mask/smokable/cigarette/Initialize()
. = ..()
initialize_reagents()
Expand Down
1 change: 0 additions & 1 deletion code/modules/integrated_electronics/subtypes/reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@
if(isliving(AM))
var/mob/living/L = AM
var/injection_status = L.can_inject(null, BP_CHEST)
log_world("Injection status? [injection_status]")
var/injection_delay = 3 SECONDS
if(injection_status == INJECTION_PORT)
injection_delay += INJECTION_PORT_DELAY
Expand Down
3 changes: 0 additions & 3 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,6 @@ default behaviour is:
else if(skip_delays || do_after(src, 5 SECONDS, user))
. = ..()

/mob/living/can_be_injected_by(var/atom/injector)
return ..() && (can_inject(null, 0, BP_CHEST) || can_inject(null, 0, BP_GROIN))

/mob/living/handle_grab_damage()
..()
if(!has_gravity())
Expand Down
5 changes: 2 additions & 3 deletions code/modules/mob/living/silicon/silicon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@

//can't inject synths
/mob/living/silicon/can_inject(var/mob/user, var/target_zone)
to_chat(user, "<span class='warning'>The armoured plating is too tough.</span>")
return 0

to_chat(user, SPAN_WARNING("The armoured plating is too tough."))
return FALSE

//Silicon mob language procs

Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/simple_animal/familiars/familiars.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
icon = 'icons/mob/simple_animal/spaceshark.dmi'
pixel_x = -16

offset_overhead_text_x = 16

speak_emote = list("gnashes")

health = 100
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1367,3 +1367,5 @@
/mob/get_overhead_text_y_offset()
return offset_overhead_text_y

/mob/can_be_injected_by(var/atom/injector)
return FALSE // Handled elsewhere in syringe logic.
3 changes: 3 additions & 0 deletions code/modules/reagents/reagent_containers/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
var/list/attack_products //Items you can craft together. Like bomb making, but with food and less screwdrivers.
// Uses format list(ingredient = result_type). The ingredient can be a typepath or a kitchen_tag string (used for mobs or plants)

/obj/item/chems/food/can_be_injected_by(var/atom/injector)
return TRUE

/obj/item/chems/food/standard_pour_into(mob/user, atom/target)
return FALSE

Expand Down
6 changes: 4 additions & 2 deletions code/modules/reagents/reagent_containers/syringes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,14 @@
to_chat(user, SPAN_NOTICE("The syringe is empty."))
mode = SYRINGE_DRAW
return
if(istype(target, /obj/item/implantcase/chem))

if(!user.Adjacent(target))
return

if(!ATOM_IS_OPEN_CONTAINER(target) && !ismob(target) && !istype(target, /obj/item/chems/food) && !istype(target, /obj/item/clothing/mask/smokable/cigarette) && !istype(target, /obj/item/storage/fancy/cigarettes))
if(!ismob(target) && (!target.reagents || !target.can_be_injected_by(src)))
to_chat(user, SPAN_NOTICE("You cannot directly fill this object."))
return

if(!REAGENTS_FREE_SPACE(target.reagents))
to_chat(user, SPAN_NOTICE("[target] is full."))
return
Expand Down

0 comments on commit 3364cc4

Please sign in to comment.