mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-05-17 12:20:09 +01:00
53a1373611
* fix some crashes * lets clean this all up * trymove * the rest * Revert "the rest" This reverts commita2076cbfb0. * Revert "trymove" This reverts commitf63e3c822f. * Revert "lets clean this all up" This reverts commitc590eef512. * lets keep this in scope * admin stuff * this too * fix * this needs to be forceMoved * Revert "this needs to be forceMoved" This reverts commitd24f883699. * stardog mouth fix and qdel
73 lines
2.5 KiB
Plaintext
73 lines
2.5 KiB
Plaintext
#define CELLS 8
|
|
#define CELLSIZE (32/CELLS)
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// Food.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/obj/item/reagent_containers/food
|
|
max_transfer_amount = null
|
|
volume = 50 //Sets the default container amount for all food items.
|
|
description_info = "Food can use the Rename Food verb in the Object Tab to rename it."
|
|
var/filling_color = "#FFFFFF" //Used by sandwiches and custom food.
|
|
drop_sound = 'sound/items/drop/food.ogg'
|
|
pickup_sound = 'sound/items/pickup/food.ogg'
|
|
|
|
var/food_can_insert_micro = FALSE
|
|
var/list/food_inserted_micros
|
|
|
|
/obj/item/reagent_containers/food/verb/change_name()
|
|
set name = "Rename Food"
|
|
set category = "Object"
|
|
set src in view(0)
|
|
|
|
handle_name_change(usr)
|
|
|
|
/obj/item/reagent_containers/food/proc/handle_name_change(var/mob/living/user)
|
|
if(user.stat == DEAD || !(ishuman(user) || isrobot(user)))
|
|
to_chat(user, span_warning("You can't cook!"))
|
|
return
|
|
var/n_name = sanitizeSafe(tgui_input_text(user, "What would you like to name \the [src]? Leave blank to reset.", "Food Naming", initial(name), MAX_NAME_LEN, encode = FALSE))
|
|
if(!n_name)
|
|
n_name = initial(name)
|
|
|
|
name = n_name
|
|
|
|
/obj/item/reagent_containers/food/Initialize(mapload)
|
|
. = ..()
|
|
if ((center_of_mass_x || center_of_mass_y) && !pixel_x && !pixel_y)
|
|
src.pixel_x = rand(-6.0, 6) //Randomizes postion
|
|
src.pixel_y = rand(-6.0, 6)
|
|
|
|
/obj/item/reagent_containers/food/attackby(obj/item/W, mob/user)
|
|
. = ..()
|
|
attempt_changeling_test(W,user)
|
|
|
|
/obj/item/reagent_containers/food/afterattack(atom/A, mob/user, proximity, params)
|
|
if((center_of_mass_x || center_of_mass_y) && proximity && params && istype(A, /obj/structure/table))
|
|
//Places the item on a grid
|
|
var/list/mouse_control = params2list(params)
|
|
|
|
var/mouse_x = text2num(mouse_control["icon-x"])
|
|
var/mouse_y = text2num(mouse_control["icon-y"])
|
|
|
|
if(!isnum(mouse_x) || !isnum(mouse_y))
|
|
return
|
|
|
|
var/cell_x = max(0, min(CELLS-1, round(mouse_x/CELLSIZE)))
|
|
var/cell_y = max(0, min(CELLS-1, round(mouse_y/CELLSIZE)))
|
|
|
|
pixel_x = (CELLSIZE * (0.5 + cell_x)) - center_of_mass_x
|
|
pixel_y = (CELLSIZE * (0.5 + cell_y)) - center_of_mass_y
|
|
|
|
/obj/item/reagent_containers/food/container_resist(mob/living/M)
|
|
if(food_inserted_micros)
|
|
food_inserted_micros -= M
|
|
if(isdisposalpacket(loc))
|
|
M.forceMove(loc)
|
|
else
|
|
M.forceMove(get_turf(src))
|
|
to_chat(M, span_warning("You climb out of \the [src]."))
|
|
|
|
#undef CELLS
|
|
#undef CELLSIZE
|