Files
Aurora.3/code/modules/cooking/trays.dm
Matt Atlas 659752e2ea Removes goonchat, adds TGChat and TG Stat Panels (#16514)
* tgui the beginning

* binaries and the like

* Bring in the last of it

* Example radio UI

* delete example

* NTOS Main Menu, start on manifest, tgui states

* tasks.json

* gunnery ui pt 1

* okay

* fix everything

* scss update

* oops

* manifest gigablast

* downloader part 1

* download prt 2

* NTOSDownloader final

* mfw committing to_worlds

* gunnery console pt2

* i cooked

* targeting (finished)

* one vueui down

* voting ui almost done

* MY MIND FEELS LIKE AN ARCH ENEMYYYY

* voting ui down

* photocopier

* ntos config + download fixes

* photocopier 2

* refactor define

* NTOS client manager + fixes

* fax machine final (it also uses toner now)

* marching forwards... left behind...

* ntnrc part 1

* canister

* add quotes

* portable pumps pt1 + more backgrounds

* oops

* finish the portable pump

* freezers

so I'll keep on pushing forward... you haven't seen the last of me... oooooooh...

* doors ui pt1

* finish doors UI (forgive me wildkins it's a bit of shitcode)

* vitals monitor, make things use labeled lists, new backgrounds

* mais j'envoyé aucun mayday...

* maglock pt1

* pour ça je me suis perdu...

* infrared

* fix that

* prox sensor pt1

* prox sensor

* signaler (this was actually pretty hard)

* atmos control pt1

* atmos control pt1.1

* atmos pt 2

* fuel injector

* multitool UI

* jammer

* list viewer

* APC

* portgen

* targeting console updates + SMES ui

* new themes, shield generator

* supermatter

* Add ore detector and (shitty) NTNet Relay

* orderterminal pt1

* orderterminal pt2

* smartfridge

* Add (air-)tank GUI update ore detector size

* Adds Transfer Valves

* Add AtmoScrubber

* analyzer pt1

* weapons analyzer pt2

* bodyscanner pt1

* bodyscanner pt2

* fix this shitcode

* seed storage

* appearance changer

* appearance changer final

* sleeper pt1

* sleeper

* gps

* vehicles

* chem dispenser

* lily request

* holopad

* tgui modules pt1

* ppanel

* damage menu

* fixes

* im here too now

* follow menu, search bars

* quikpay

* quikpay fixes

* circuit printer

* ppanel

* ppanel updates

* pai

* turret controls (i want to kill myself)

* tweak

* remove the boardgame

* guntracker

* implant tracker

* penal mechs

come close to me, come close to me

* chem codex

* pai radio

* doorjack

* pai directives

* signaler removal, sensors

* ghost spawner

* spawnpoint

* fixes

* teleporter

* one more to the chopping block

* account database

* remove divider

* scanner, atmos

* latejoin ui pt1

* latejoin

* records pt1

* RECORDS UI DONE

* delete interpreter & records

* CHAT FUCKING CLIENT

* data updates

* fix some things

* final UI, log

* basic nanoui fix

* antag panel

* remove vueui

* atm update

* vending update

* warrants, cameras

* ntmonitor

* time comes for all

* preserve this legacy

* bring that back (oops)

* rcon, ui auto update for computer UIs, remove rcon computers

* alarm monitoring (a bit broke and also todo: add custom alarm monitoring programs to a few consoles)

* A LIKE SUPREME

* a

* power monitor

* lights on

* fuck this code, fuck nanoui modules, and fuck nanoui

* LEAVE IT OH SO FAR BEHIND

* fix alarm monitoring for synths

* I SAW IN YOU WHAT LIFE WAS MISSING

* comms console

* idcard and record updates

* turn the light on

* arcade

* pt2

* news browser

* static

* crusher

* f

* COULD I JUST SLEIGH THE GOLD FROM THE BALLS? I'M SO FRUSTRATED OH COULD YOU TELL? IF I HEAR ONE MORE VUEUI OR ONE NANOUI I'M GONNA LOSE IT SO LET ME GOOOOOOOOOOOOOOOOO

* codeowners & suit sensors

* html ui style removal

* make lint happy

* tgchat

* tgpanels pt1

* THE SOUL LONGS FOR OBLIVION!!!!!!!!!!!!!!!!!

* figure out why stat isnt working

* goodbye ping

* shhh

* stat updates

* An oath sworn in scors! Omni vortex lies!

* final almost edits

* fix that

* last skin adjustments

* resist and disorder

* i slowly get up and turn off the noise, already fed up...

* pleaseeeeeeeeeeeeeee

* THE CREDIT LARP IS NECESSARY

* i hold the keys

* RISE UP

* fix that?

* harry's suggestions xoxo

* runtime fix pt2

* You are the only thing that I still care about

* fix runtimes and cl

* whoops

* misc fixes

* fix that too

* adds build workflow

* f

* Update update_tgui.yml

* adds some needed steps

* ATM

* misc fixes and tweaks

* fixes 2

* make newscasters usable and fix use power on freezers

* turret control is clearer

* remove duplicate

* makes some verb tabs work properly

* makes verbs work properly for real

* sans moi

* fixes pt2

* fix the chat unnecessarily reloading

* fixes

* epic

* fixes

* fix missing consoles

---------

Co-authored-by: John Wildkins <john.wildkins@gmail.com>
Co-authored-by: Matt Atlas <liermattia@gmail.com>
Co-authored-by: harryob <55142896+harryob@users.noreply.github.com>
Co-authored-by: Werner <Arrow768@users.noreply.github.com>
Co-authored-by: Geeves <ggrobler447@gmail.com>
Co-authored-by: harryob <me@harryob.live>
2023-06-26 02:00:14 +02:00

222 lines
7.0 KiB
Plaintext

/*
* Trays - Nanako, ported by Jade
*/
//Use tray on an item to load it.
//To unload, place on a table, then rightclic > Unload tray. Alternatively, alt+click on the tray to unload it
//Tray will spill if thrown, dropped on the floor, or used to hit someone with. Spilling scatters contents
/obj/item/tray
name = "tray"
icon = 'icons/obj/food.dmi'
icon_state = "tray"
desc = "A metal tray to lay food on."
throwforce = 12.0
force = 10.0
throw_speed = 1
throw_range = 5
w_class = 3.0
flags = CONDUCT
matter = list(DEFAULT_WALL_MATERIAL = 3000)
recyclable = TRUE
hitsound = /singleton/sound_category/bottle_hit_broken
drop_sound = /singleton/sound_category/bottle_hit_broken
var/max_carry = 20
var/current_weight = 0
var/cooldown = 0 //shield bash cooldown. based on world.time
var/safedrop = 0 //Used to tell when we should or shouldn't spill if the tray is dropped.
//Safedrop is set true when throwing, because it will spill on impact. And when placing on a table
/obj/item/tray/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone)
. = ..()
if(isemptylist(contents))
return
spill(user, target.loc)
/obj/item/tray/attackby(obj/item/I, mob/user, var/click_params)
if (isrobot(I.loc))//safety to stop robots losing their items
return TRUE
if(istype(I, /obj/item/material/kitchen/rollingpin))
if(cooldown < world.time - 25)
user.visible_message(SPAN_DANGER("[user] bashes [src] with [I]!"))
playsound(user.loc, 'sound/effects/shieldbash.ogg', 50, 1)
cooldown = world.time
return TRUE
attempt_load_item(I, user, click_params=click_params)
/*
============~~~~~======================~~~~~=============
= =
= Code for trays carrying things. By Nanako. And Jade.
= =
============~~~~~====================~~~~~===============
*/
//Clicking a table places the tray on it safely.
/obj/item/tray/afterattack(atom/target, mob/user, proximity)
if (istype(target,/obj/structure/table))
safedrop = TRUE
if (!proximity)
return
if (!istype(target,/obj/item))
return
. = ..()
/obj/item/tray/AltClick(var/mob/user)
if (user.stat || user.incapacitated() || !user.Adjacent(src))
return
unload_at_loc(user=user)
/obj/item/tray/proc/attempt_load_item(var/obj/item/I, var/mob/user, var/messages = TRUE, var/click_params)
if(!I || (I in contents))
return
if(I == src || I.anchored || istype(I, /obj/item/projectile))
return
if(istype(I, /obj/item/tray))
var/obj/item/tray/T = I
if(!(current_weight || T.current_weight))
return
T.spill()
spill()
user.visible_message(
"<b>[user]</b> tries to stack two trays and spills their contents everywhere!",
SPAN_WARNING("You spill both the trays' contents!"),
SPAN_WARNING("You hear the sound of metal crashing!")
)
return
var/remaining = max_carry - current_weight
if (remaining >= I.w_class)
load_item(I,user, click_params)
if (messages)
user.visible_message(
"<b>[user]</b> places [I] on the tray.",
SPAN_NOTICE("You place [I] on the tray."),
SPAN_NOTICE("You hear something being placed on a tray.")
)
return TRUE
if (messages)
to_chat(user, SPAN_NOTICE("The tray can't take that much weight!"))
return FALSE
/obj/item/tray/proc/load_item(var/obj/item/I, var/mob/user, var/click_params)
user.remove_from_mob(I)
I.forceMove(src)
auto_align(I, click_params)
current_weight += I.w_class
vis_contents += I
I.vis_flags |= VIS_INHERIT_LAYER | VIS_INHERIT_PLANE
item_equipped_event.register(I, src, PROC_REF(pick_up))
destroyed_event.register(I, src, PROC_REF(unload_item))
/obj/item/tray/verb/unload()
set name = "Unload Tray"
set category = "Object"
set src in view(1)
unload_at_loc(user = usr)
#define CELLS 16 //Amount of cells per row/column in grid
#define CELLSIZE (world.icon_size/CELLS) //Size of a cell in pixels
/obj/item/tray/proc/auto_align(obj/item/W, click_parameters)
if(!W.center_of_mass)
W.randpixel_xy()
return
if(!click_parameters)
return
var/list/mouse_control = mouse_safe_xy(click_parameters)
var/mouse_x = mouse_control["icon-x"]
var/mouse_y = mouse_control["icon-y"]
if(isnum(mouse_x) && isnum(mouse_y))
var/cell_x = max(0, min(CELLS-1, round(mouse_x/CELLSIZE)))
var/cell_y = max(0, min(CELLS-1, round(mouse_y/CELLSIZE)))
W.pixel_x = (CELLSIZE * (0.5 + cell_x)) - W.center_of_mass["x"]
W.pixel_y = (CELLSIZE * (0.5 + cell_y)) - W.center_of_mass["y"]
#undef CELLS
#undef CELLSIZE
/obj/item/tray/proc/pick_up(var/obj/item/contained, var/mob/moved_to, var/slot)
unload_item(contained, moved_to)
/obj/item/tray/proc/unload_item(var/obj/item/contained, var/atom/dropspot = null)
item_equipped_event.unregister(contained, src)
if(dropspot)
contained.forceMove(dropspot)
vis_contents.Remove(contained)
contained.vis_flags = initial(contained.vis_flags)
current_weight -= min(contained.w_class, current_weight)
/obj/item/tray/proc/unload_at_loc(var/turf/dropspot = null, var/mob/user)
if (!current_weight)
return
if (!isturf(loc) && !dropspot)//check that we're not being held by a mob
to_chat(user, SPAN_NOTICE("Place the tray down first!"))
return
if (!dropspot)
dropspot = get_turf(src)
for(var/obj/item/I in contents)
unload_item(I, dropspot)
user.visible_message("<b>[user]</b> unloads the tray.", SPAN_NOTICE("You unload the tray."))
/obj/item/tray/proc/spill(var/mob/user = null, var/turf/dropspot = null)
//This proc is called when a tray is thrown or dropped on the floor
//its also called when a cyborg uses its tray on the floor
if (!current_weight)//can't spill a tray with nothing on it
return
//First we have to find where the items are being dropped, unless a location has been passed in
if (!dropspot)
dropspot = get_turf(src)
for(var/obj/item/I in contents)
unload_item(I, dropspot)
I.throw_at(get_edge_target_turf(src, pick(alldirs)), rand(0, 2), 10)
if (user)
user.visible_message("<b>[user]</b> spills their tray all over the floor.", SPAN_WARNING("You spill the tray!"))
else
visible_message(SPAN_NOTICE("The tray scatters its contents all over the area."))
playsound(dropspot, /singleton/sound_category/tray_hit_sound, 50, 1)
/obj/item/tray/throw_impact(atom/hit_atom)
spill(null, loc)
/obj/item/tray/throw_at(atom/target, throw_range, throw_speed, mob/user)
safedrop = 1//we dont want the tray to spill when thrown, it will spill on impact instead
..()
/obj/item/tray/dropped(mob/user)
. = ..()
spawn(1)//A hack to avoid race conditions. Dropped procs too quickly
if (ismob(loc))
//If this is true, then the tray has just switched hands and is still held by a mob
return
if (!safedrop)
spill(user, loc)
safedrop = FALSE
/obj/item/tray/resolve_attackby(atom/A, mob/user, var/click_parameters)
if(istype(A,/obj/structure/table))
safedrop = TRUE
return ..(A, user, click_parameters)
/obj/item/tray/plate
name = "serving plate"
desc = "A large plate for serving meals on."
icon = 'icons/obj/kitchen.dmi'
icon_state = "l_plate"
throwforce = 4
force = 3
flags = null
matter = list(DEFAULT_TABLE_MATERIAL = 1000)
recyclable = TRUE
max_carry = 7 // That's 3 dishes, a knife, spoon and fork and a glass