mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-26 10:04:12 +00:00
committed by
Chompstation Bot
parent
7304bde62e
commit
c495e183a8
@@ -15,24 +15,44 @@
|
||||
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/weakref/loaded //Weakref for currently loaded food object.
|
||||
var/scoop_volume = 5
|
||||
var/loaded // Name for currently loaded food object.
|
||||
var/loaded_color // Color for currently loaded food object.
|
||||
|
||||
/obj/item/weapon/material/kitchen/utensil/New()
|
||||
..()
|
||||
/obj/item/weapon/material/kitchen/utensil/Initialize()
|
||||
. = ..()
|
||||
if (prob(60))
|
||||
src.pixel_y = rand(0, 4)
|
||||
create_reagents(5)
|
||||
return
|
||||
create_reagents(scoop_volume)
|
||||
|
||||
/obj/item/weapon/material/kitchen/utensil/update_icon()
|
||||
. = ..()
|
||||
cut_overlays()
|
||||
var/obj/item/weapon/reagent_containers/food/snacks/eaten = loaded?.resolve()
|
||||
if(eaten)
|
||||
if(loaded)
|
||||
var/image/I = new(icon, "loadedfood")
|
||||
I.color = eaten.filling_color
|
||||
I.color = loaded_color
|
||||
add_overlay(I)
|
||||
|
||||
/obj/item/weapon/material/kitchen/utensil/proc/load_food(var/mob/user, var/obj/item/weapon/reagent_containers/food/snacks/loading)
|
||||
if (reagents.total_volume > 0)
|
||||
to_chat(user, SPAN_DANGER("There is already something on \the [src]."))
|
||||
return
|
||||
if (!loading?.reagents?.total_volume)
|
||||
to_chat(user, SPAN_NOTICE("Nothing to scoop up in \the [loading]!"))
|
||||
|
||||
|
||||
loaded = "\the [loading]"
|
||||
user.visible_message( \
|
||||
"<b>\The [user]</b> scoops up some of [loaded] with \the [src]!",
|
||||
SPAN_NOTICE("You scoop up some of [loaded] with \the [src]!")
|
||||
)
|
||||
loading.bitecount++
|
||||
loading.reagents.trans_to_obj(src, min(loading.reagents.total_volume, scoop_volume))
|
||||
loaded_color = loading.filling_color
|
||||
if (loading.reagents.total_volume <= 0)
|
||||
qdel(loading)
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/material/kitchen/utensil/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
|
||||
if(!istype(M))
|
||||
return ..()
|
||||
@@ -46,19 +66,18 @@
|
||||
return ..()
|
||||
|
||||
if (loaded && reagents.total_volume > 0)
|
||||
var/atom/movable/eaten = loaded?.resolve()
|
||||
reagents.trans_to_mob(M, reagents.total_volume, CHEM_INGEST)
|
||||
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)
|
||||
if(M == user)
|
||||
if(!M.can_eat(loaded))
|
||||
return
|
||||
M.visible_message("<b>\The [user]</b> eats some of [loaded] with \the [src].")
|
||||
else
|
||||
user.visible_message(SPAN_WARNING("\The [user] begins to feed \the [M]!"))
|
||||
if(!(M.can_force_feed(user, loaded) && do_mob(user, M, 5 SECONDS)))
|
||||
return
|
||||
M.visible_message("<b>\The [user]</b> feeds some of [loaded] to \the [M] with \the [src].")
|
||||
playsound(src,'sound/items/eatfood.ogg', rand(10,40), 1)
|
||||
loaded = null
|
||||
update_icon()
|
||||
return
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user