mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-20 03:26:37 +01:00
Refactors utensils to use weakrefs
This commit is contained in:
@@ -11,12 +11,11 @@
|
||||
thrown_force_divisor = 1
|
||||
origin_tech = list(TECH_MATERIAL = 1)
|
||||
attack_verb = list("attacked", "stabbed", "poked")
|
||||
sharp = 1
|
||||
edge = 1
|
||||
sharp = TRUE
|
||||
edge = TRUE
|
||||
force_divisor = 0.1 // 6 when wielded with hardness 60 (steel)
|
||||
thrown_force_divisor = 0.25 // 5 when thrown with weight 20 (steel)
|
||||
var/loaded //Descriptive string for currently loaded food object.
|
||||
var/scoop_food = 1
|
||||
var/weakref/loaded //Weakref for currently loaded food object.
|
||||
|
||||
/obj/item/weapon/material/kitchen/utensil/New()
|
||||
..()
|
||||
@@ -25,6 +24,15 @@
|
||||
create_reagents(5)
|
||||
return
|
||||
|
||||
/obj/item/weapon/material/kitchen/utensil/update_icon()
|
||||
. = ..()
|
||||
cut_overlays()
|
||||
var/obj/item/weapon/reagent_containers/food/snacks/eaten = loaded?.resolve()
|
||||
if(eaten)
|
||||
var/image/I = new(icon, "loadedfood")
|
||||
I.color = eaten.filling_color
|
||||
add_overlay(I)
|
||||
|
||||
/obj/item/weapon/material/kitchen/utensil/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
|
||||
if(!istype(M))
|
||||
return ..()
|
||||
@@ -37,8 +45,10 @@
|
||||
else
|
||||
return ..()
|
||||
|
||||
if (reagents.total_volume > 0)
|
||||
if (loaded && reagents.total_volume > 0)
|
||||
var/atom/movable/eaten = loaded?.resolve()
|
||||
reagents.trans_to_mob(M, reagents.total_volume, CHEM_INGEST)
|
||||
<<<<<<< HEAD
|
||||
if(M == user)
|
||||
if(!M.can_eat(loaded))
|
||||
return
|
||||
@@ -50,17 +60,31 @@
|
||||
M.visible_message("<span class='notice'>\The [user] feeds some [loaded] to \the [M] with \the [src].</span>")
|
||||
playsound(src,'sound/items/eatfood.ogg', rand(10,40), 1)
|
||||
cut_overlays()
|
||||
=======
|
||||
if(eaten)
|
||||
if(M == user)
|
||||
if(!M.can_eat(eaten))
|
||||
return
|
||||
M.visible_message(SPAN_NOTICE("\The [user] eats some of \the [eaten] with \the [src]."))
|
||||
else
|
||||
user.visible_message(SPAN_WARNING("\The [user] begins to feed \the [M]!"))
|
||||
if(!(M.can_force_feed(user, eaten) && do_mob(user, M, 5 SECONDS)))
|
||||
return
|
||||
M.visible_message(SPAN_NOTICE("\The [user] feeds some of \the [eaten] to \the [M] with \the [src]."))
|
||||
playsound(src,'sound/items/eatfood.ogg', rand(10,40), 1)
|
||||
update_icon()
|
||||
>>>>>>> 1672a51... Refactors utensils to use weakrefs (#8140)
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You don't have anything on \the [src].</span>") //if we have help intent and no food scooped up DON'T STAB OURSELVES WITH THE FORK
|
||||
to_chat(user, SPAN_WARNING("You don't have anything on \the [src].")) //if we have help intent and no food scooped up DON'T STAB OURSELVES WITH THE FORK
|
||||
return
|
||||
|
||||
/obj/item/weapon/material/kitchen/utensil/fork
|
||||
name = "fork"
|
||||
desc = "It's a fork. Sure is pointy."
|
||||
icon_state = "fork"
|
||||
sharp = 1
|
||||
edge = 0
|
||||
sharp = TRUE
|
||||
edge = FALSE
|
||||
|
||||
/obj/item/weapon/material/kitchen/utensil/fork/plastic
|
||||
default_material = "plastic"
|
||||
@@ -70,8 +94,8 @@
|
||||
desc = "It's a spoon. You can see your own upside-down face in it."
|
||||
icon_state = "spoon"
|
||||
attack_verb = list("attacked", "poked")
|
||||
edge = 0
|
||||
sharp = 0
|
||||
edge = FALSE
|
||||
sharp = FALSE
|
||||
force_divisor = 0.1 //2 when wielded with weight 20 (steel)
|
||||
|
||||
/obj/item/weapon/material/kitchen/utensil/spoon/plastic
|
||||
|
||||
Reference in New Issue
Block a user