From 6efa3bcdaa1be208dd1ab3c90d7f3b83b1b3d107 Mon Sep 17 00:00:00 2001 From: Markolie Date: Wed, 25 Feb 2015 20:42:43 +0100 Subject: [PATCH] Fix trays (now bags) --- code/datums/cargoprofile.dm | 4 +- code/game/machinery/vending.dm | 2 +- code/game/objects/items/weapons/kitchen.dm | 234 +----------------- .../objects/items/weapons/storage/bags.dm | 104 ++++++++ .../objects/items/weapons/storage/storage.dm | 13 - .../mob/living/silicon/robot/robot_items.dm | 90 +------ .../mob/living/silicon/robot/robot_modules.dm | 4 +- .../reagent_containers/food/snacks.dm | 2 +- 8 files changed, 112 insertions(+), 341 deletions(-) diff --git a/code/datums/cargoprofile.dm b/code/datums/cargoprofile.dm index c2a5ed8bea1..36d4748cfc8 100644 --- a/code/datums/cargoprofile.dm +++ b/code/datums/cargoprofile.dm @@ -103,7 +103,7 @@ id = "boxes" blacklist = null whitelist = list(/obj/item/weapon/storage, /obj/item/weapon/moneybag, /obj/item/weapon/evidencebag, - /obj/item/weapon/tray, /obj/item/pizzabox, /obj/item/weapon/clipboard, + /obj/item/weapon/storage/bag/tray, /obj/item/pizzabox, /obj/item/weapon/clipboard, /obj/item/smallDelivery, /obj/structure/bigDelivery) /datum/cargoprofile/cargo @@ -270,7 +270,7 @@ /obj/item/weapon/hand_labeler,/obj/item/weapon/hemostat,/obj/item/weapon/mop,/obj/item/weapon/locator,/obj/item/weapon/minihoe, /obj/item/stack/packageWrap,/obj/item/weapon/pen,/obj/item/weapon/pickaxe,/obj/item/weapon/pinpointer, /obj/item/weapon/rcd,/obj/item/weapon/rcd_ammo,/obj/item/weapon/retractor,/obj/item/weapon/rsf,/obj/item/weapon/rsp,/obj/item/weapon/scalpel, - /obj/item/weapon/screwdriver,/obj/item/weapon/shovel,/obj/item/weapon/soap,/obj/item/weapon/stamp,/obj/item/weapon/tray,/obj/item/weapon/weldingtool, + /obj/item/weapon/screwdriver,/obj/item/weapon/shovel,/obj/item/weapon/soap,/obj/item/weapon/stamp,/obj/item/weapon/storage/bag/tray,/obj/item/weapon/weldingtool, /obj/item/weapon/wirecutters,/obj/item/weapon/wrench,/obj/item/weapon/extinguisher) /datum/cargoprofile/finished diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index a74d7ad5bde..1885645ca37 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -1053,7 +1053,7 @@ desc = "A kitchen and restaurant equipment vendor" product_ads = "Mm, food stuffs!;Food and food accessories.;Get your plates!;You like forks?;I like forks.;Woo, utensils.;You don't really need these..." icon_state = "dinnerware" - products = list(/obj/item/weapon/tray = 8,/obj/item/weapon/kitchen/utensil/fork = 6,/obj/item/weapon/kitchenknife = 3,/obj/item/weapon/reagent_containers/food/drinks/drinkingglass = 8,/obj/item/clothing/suit/chef/classic = 2,/obj/item/weapon/reagent_containers/food/condiment/pack/ketchup = 5,/obj/item/weapon/reagent_containers/food/condiment/pack/hotsauce = 5) + products = list(/obj/item/weapon/storage/bag/tray = 8,/obj/item/weapon/kitchen/utensil/fork = 6,/obj/item/weapon/kitchenknife = 3,/obj/item/weapon/reagent_containers/food/drinks/drinkingglass = 8,/obj/item/clothing/suit/chef/classic = 2,/obj/item/weapon/reagent_containers/food/condiment/pack/ketchup = 5,/obj/item/weapon/reagent_containers/food/condiment/pack/hotsauce = 5) contraband = list(/obj/item/weapon/kitchen/utensil/spoon = 2,/obj/item/weapon/kitchen/utensil/knife = 2,/obj/item/weapon/kitchen/rollingpin = 2, /obj/item/weapon/butch = 2) /obj/machinery/vending/sovietsoda diff --git a/code/game/objects/items/weapons/kitchen.dm b/code/game/objects/items/weapons/kitchen.dm index 2ed20f0e535..7661322945b 100644 --- a/code/game/objects/items/weapons/kitchen.dm +++ b/code/game/objects/items/weapons/kitchen.dm @@ -7,7 +7,6 @@ * Kitchen knives * Butcher's cleaver * Rolling Pins - * Trays */ /obj/item/weapon/kitchen @@ -253,235 +252,4 @@ H.eye_blurry += 3 return ..() -/* - * Trays - Agouri - */ -/obj/item/weapon/tray - name = "tray" - icon = 'icons/obj/food.dmi' - icon_state = "tray" - desc = "A metal tray to lay food on." - throwforce = 5.0 - throwforce = 10.0 - throw_speed = 3 - throw_range = 5 - w_class = 4.0 - flags = CONDUCT - m_amt = 3000 - /* // NOPE - var/food_total= 0 - var/burger_amt = 0 - var/cheese_amt = 0 - var/fries_amt = 0 - var/classyalcdrink_amt = 0 - var/alcdrink_amt = 0 - var/bottle_amt = 0 - var/soda_amt = 0 - var/carton_amt = 0 - var/pie_amt = 0 - var/meatbreadslice_amt = 0 - var/salad_amt = 0 - var/miscfood_amt = 0 - */ - var/list/carrying = list() // List of things on the tray. - Doohl - var/max_carry = 10 // w_class = 1 -- takes up 1 - // w_class = 2 -- takes up 3 - // w_class = 3 -- takes up 5 - -/obj/item/weapon/tray/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) - - // Drop all the things. All of them. - overlays.Cut() - for(var/obj/item/I in carrying) - I.loc = M.loc - carrying.Remove(I) - if(isturf(I.loc)) - spawn() - for(var/i = 1, i <= rand(1,2), i++) - if(I) - step(I, pick(NORTH,SOUTH,EAST,WEST)) - sleep(rand(2,4)) - - - if((CLUMSY in user.mutations) && prob(50)) //What if he's a clown? - M << "\red You accidentally slam yourself with the [src]!" - M.Weaken(1) - user.take_organ_damage(2) - if(prob(50)) - playsound(M, 'sound/items/trayhit1.ogg', 50, 1) - return - else - playsound(M, 'sound/items/trayhit2.ogg', 50, 1) //sound playin' - return //it always returns, but I feel like adding an extra return just for safety's sakes. EDIT; Oh well I won't :3 - - var/mob/living/carbon/human/H = M ///////////////////////////////////// /Let's have this ready for later. - - - if(!(user.zone_sel.selecting == ("eyes" || "head"))) //////////////hitting anything else other than the eyes - if(prob(33)) - src.add_blood(H) - var/turf/location = H.loc - if (istype(location, /turf/simulated)) - location.add_blood(H) ///Plik plik, the sound of blood - - M.attack_log += text("\[[time_stamp()]\] Has been attacked with [src.name] by [user.name] ([user.ckey])") - user.attack_log += text("\[[time_stamp()]\] Used the [src.name] to attack [M.name] ([M.ckey])") - msg_admin_attack("[user.name] ([user.ckey]) used the [src.name] to attack [M.name] ([M.ckey]) (JMP)") - - if(!iscarbon(user)) - M.LAssailant = null - else - M.LAssailant = user - - if(prob(15)) - M.Weaken(3) - M.take_organ_damage(3) - else - M.take_organ_damage(5) - if(prob(50)) - playsound(M, 'sound/items/trayhit1.ogg', 50, 1) - for(var/mob/O in viewers(M, null)) - O.show_message(text("\red [] slams [] with the tray!", user, M), 1) - return - else - playsound(M, 'sound/items/trayhit2.ogg', 50, 1) //we applied the damage, we played the sound, we showed the appropriate messages. Time to return and stop the proc - for(var/mob/O in viewers(M, null)) - O.show_message(text("\red [] slams [] with the tray!", user, M), 1) - return - - - - - if(istype(M, /mob/living/carbon/human) && ((H.head && H.head.flags & HEADCOVERSEYES) || (H.wear_mask && H.wear_mask.flags & MASKCOVERSEYES) || (H.glasses && H.glasses.flags & GLASSESCOVERSEYES))) - M << "\red You get slammed in the face with the tray, against your mask!" - if(prob(33)) - src.add_blood(H) - if (H.wear_mask) - H.wear_mask.add_blood(H) - if (H.head) - H.head.add_blood(H) - if (H.glasses && prob(33)) - H.glasses.add_blood(H) - var/turf/location = H.loc - if (istype(location, /turf/simulated)) //Addin' blood! At least on the floor and item :v - location.add_blood(H) - - if(prob(50)) - playsound(M, 'sound/items/trayhit1.ogg', 50, 1) - for(var/mob/O in viewers(M, null)) - O.show_message(text("\red [] slams [] with the tray!", user, M), 1) - else - playsound(M, 'sound/items/trayhit2.ogg', 50, 1) //sound playin' - for(var/mob/O in viewers(M, null)) - O.show_message(text("\red [] slams [] with the tray!", user, M), 1) - if(prob(10)) - M.Stun(rand(1,3)) - M.take_organ_damage(3) - return - else - M.take_organ_damage(5) - return - - else //No eye or head protection, tough luck! - M << "\red You get slammed in the face with the tray!" - if(prob(33)) - src.add_blood(M) - var/turf/location = H.loc - if (istype(location, /turf/simulated)) - location.add_blood(H) - - if(prob(50)) - playsound(M, 'sound/items/trayhit1.ogg', 50, 1) - for(var/mob/O in viewers(M, null)) - O.show_message(text("\red [] slams [] in the face with the tray!", user, M), 1) - else - playsound(M, 'sound/items/trayhit2.ogg', 50, 1) //sound playin' again - for(var/mob/O in viewers(M, null)) - O.show_message(text("\red [] slams [] in the face with the tray!", user, M), 1) - if(prob(30)) - M.Stun(rand(2,4)) - M.take_organ_damage(4) - return - else - M.take_organ_damage(8) - if(prob(30)) - M.Weaken(2) - return - return - -/obj/item/weapon/tray/var/cooldown = 0 //shield bash cooldown. based on world.time - -/obj/item/weapon/tray/attackby(obj/item/weapon/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/weapon/kitchen/rollingpin)) - if(cooldown < world.time - 25) - user.visible_message("[user] bashes [src] with [W]!") - playsound(user.loc, 'sound/effects/shieldbash.ogg', 50, 1) - cooldown = world.time - else - ..() - -/* -===============~~~~~================================~~~~~==================== -= = -= Code for trays carrying things. By Doohl for Doohl erryday Doohl Doohl~ = -= = -===============~~~~~================================~~~~~==================== -*/ -/obj/item/weapon/tray/proc/calc_carry() - // calculate the weight of the items on the tray - var/val = 0 // value to return - - for(var/obj/item/I in carrying) - if(I.w_class == 1.0) - val ++ - else if(I.w_class == 2.0) - val += 3 - else - val += 5 - - return val - -/obj/item/weapon/tray/pickup(mob/user) - - if(!isturf(loc)) - return - - for(var/obj/item/I in loc) - if( I != src && !I.anchored && !istype(I, /obj/item/clothing/under) && !istype(I, /obj/item/clothing/suit) && !istype(I, /obj/item/projectile) ) - var/add = 0 - if(I.w_class == 1.0) - add = 1 - else if(I.w_class == 2.0) - add = 3 - else - add = 5 - if(calc_carry() + add >= max_carry) - break - - I.loc = src - carrying.Add(I) - overlays += image("icon" = I.icon, "icon_state" = I.icon_state, "layer" = 30 + I.layer) - -/obj/item/weapon/tray/dropped(mob/user) - - var/mob/living/M - for(M in src.loc) //to handle hand switching - return - - var/foundtable = 0 - for(var/obj/structure/table/T in loc) - foundtable = 1 - break - - overlays.Cut() - - for(var/obj/item/I in carrying) - I.loc = loc - carrying.Remove(I) - if(!foundtable && isturf(loc)) - // if no table, presume that the person just shittily dropped the tray on the ground and made a mess everywhere! - spawn() - for(var/i = 1, i <= rand(1,2), i++) - if(I) - step(I, pick(NORTH,SOUTH,EAST,WEST)) - sleep(rand(2,4)) +/* Trays moved to /obj/item/weapon/storage/bag */ \ No newline at end of file diff --git a/code/game/objects/items/weapons/storage/bags.dm b/code/game/objects/items/weapons/storage/bags.dm index c78906a6639..ff1b025a2ee 100644 --- a/code/game/objects/items/weapons/storage/bags.dm +++ b/code/game/objects/items/weapons/storage/bags.dm @@ -10,6 +10,7 @@ * Plant Bag * Sheet Snatcher * Book Bag + * Tray * * -Sayu */ @@ -37,6 +38,11 @@ storage_slots = 30 can_hold = list() // any cant_hold = list("/obj/item/weapon/disk/nuclear","/obj/item/flag/nation") + +/obj/item/weapon/storage/bag/trash/suicide_act(mob/user) + user.visible_message("[user] puts the [src.name] over their head and starts chomping at the insides! Disgusting!") + playsound(loc, 'sound/items/eatfood.ogg', 50, 1, -1) + return (TOXLOSS) /obj/item/weapon/storage/bag/trash/update_icon() if(contents.len == 0) @@ -47,10 +53,15 @@ icon_state = "trashbag2" else icon_state = "trashbag3" +/obj/item/weapon/storage/bag/trash/cyborg + /obj/item/weapon/storage/bag/trash/proc/janicart_insert(mob/user, obj/structure/janitorialcart/J) J.put_in_cart(src, user) J.mybag=src J.update_icon() + +/obj/item/weapon/storage/bag/trash/cyborg/janicart_insert(mob/user, obj/structure/janitorialcart/J) + return // ----------------------------- @@ -323,3 +334,96 @@ max_w_class = 3 w_class = 4 //Bigger than a book because physics can_hold = list(/obj/item/weapon/book, /obj/item/weapon/spellbook) //No bibles, consistent with bookcase + +/* + * Trays - Agouri + */ +/obj/item/weapon/storage/bag/tray + name = "tray" + icon = 'icons/obj/food.dmi' + icon_state = "tray" + desc = "A metal tray to lay food on." + force = 5 + throwforce = 10.0 + throw_speed = 3 + throw_range = 5 + w_class = 4.0 + flags = CONDUCT + m_amt = 3000 + +/obj/item/weapon/storage/bag/tray/attack(mob/living/M as mob, mob/living/user as mob) + ..() + // Drop all the things. All of them. + var/list/obj/item/oldContents = contents.Copy() + quick_empty() + + // Make each item scatter a bit + for(var/obj/item/I in oldContents) + spawn() + for(var/i = 1, i <= rand(1,2), i++) + if(I) + step(I, pick(NORTH,SOUTH,EAST,WEST)) + sleep(rand(2,4)) + + if(prob(50)) + playsound(M, 'sound/items/trayhit1.ogg', 50, 1) + else + playsound(M, 'sound/items/trayhit2.ogg', 50, 1) + + if(ishuman(M) || ismonkey(M)) + if(prob(10)) + M.Weaken(2) + +/obj/item/weapon/storage/bag/tray/proc/rebuild_overlays() + overlays.Cut() + for(var/obj/item/I in contents) + overlays += image("icon" = I.icon, "icon_state" = I.icon_state, "layer" = -1) + +/obj/item/weapon/storage/bag/tray/remove_from_storage(obj/item/W as obj, atom/new_location) + ..() + rebuild_overlays() + +/obj/item/weapon/storage/bag/tray/handle_item_insertion(obj/item/I, prevent_warning = 0) + overlays += image("icon" = I.icon, "icon_state" = I.icon_state, "layer" = -1) + ..() + +/obj/item/weapon/storage/bag/tray/cyborg + +/obj/item/weapon/storage/bag/tray/cyborg/afterattack(atom/target, mob/user as mob) + if ( isturf(target) || istype(target,/obj/structure/table) ) + var foundtable = istype(target,/obj/structure/table/) + if ( !foundtable ) //it must be a turf! + for(var/obj/structure/table/T in target) + foundtable = 1 + break + + var turf/dropspot + if ( !foundtable ) // don't unload things onto walls or other silly places. + dropspot = user.loc + else if ( isturf(target) ) // they clicked on a turf with a table in it + dropspot = target + else // they clicked on a table + dropspot = target.loc + + overlays = null + + var droppedSomething = 0 + + for(var/obj/item/I in contents) + I.loc = dropspot + contents.Remove(I) + droppedSomething = 1 + if(!foundtable && isturf(dropspot)) + // if no table, presume that the person just shittily dropped the tray on the ground and made a mess everywhere! + spawn() + for(var/i = 1, i <= rand(1,2), i++) + if(I) + step(I, pick(NORTH,SOUTH,EAST,WEST)) + sleep(rand(2,4)) + if ( droppedSomething ) + if ( foundtable ) + user.visible_message("\blue [user] unloads their service tray.") + else + user.visible_message("\blue [user] drops all the items on their tray.") + + return ..() diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index bbe4a083468..899b16cf2ef 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -336,19 +336,6 @@ if(!can_be_inserted(W)) return 0 - if(istype(W, /obj/item/weapon/tray)) - var/obj/item/weapon/tray/T = W - if(T.calc_carry() > 0) - if(prob(85)) - user << "\red The tray won't fit in [src]." - return 1 - else - W.loc = user.loc - if ((user.client && user.s_active != src)) - user.client.screen -= W - W.dropped(user) - user << "\red God damnit!" - handle_item_insertion(W) return 1 diff --git a/code/modules/mob/living/silicon/robot/robot_items.dm b/code/modules/mob/living/silicon/robot/robot_items.dm index 931cb0556be..dbfcf15caa8 100644 --- a/code/modules/mob/living/silicon/robot/robot_items.dm +++ b/code/modules/mob/living/silicon/robot/robot_items.dm @@ -1,92 +1,4 @@ -// A special tray for the service droid. Allow droid to pick up and drop items as if they were using the tray normally -// Click on table to unload, click on item to load. Otherwise works identically to a tray. -// Unlike the base item "tray", robotrays ONLY pick up food, drinks and condiments. - -/obj/item/weapon/tray/robotray - name = "RoboTray" - desc = "An autoloading tray specialized for carrying refreshments." - -/obj/item/weapon/tray/robotray/afterattack(atom/target, mob/user as mob) - if ( !target ) - return - // pick up items, mostly copied from base tray pickup proc - // see code\game\objects\items\weapons\kitchen.dm line 241 - if ( istype(target,/obj/item)) - if ( !isturf(target.loc) ) // Don't load up stuff if it's inside a container or mob! - return - var turf/pickup = target.loc - - var addedSomething = 0 - - for(var/obj/item/weapon/reagent_containers/food/I in pickup) - - - if( I != src && !I.anchored && !istype(I, /obj/item/clothing/under) && !istype(I, /obj/item/clothing/suit) && !istype(I, /obj/item/projectile) ) - var/add = 0 - if(I.w_class == 1.0) - add = 1 - else if(I.w_class == 2.0) - add = 3 - else - add = 5 - if(calc_carry() + add >= max_carry) - break - - I.loc = src - carrying.Add(I) - overlays += image("icon" = I.icon, "icon_state" = I.icon_state, "layer" = 30 + I.layer) - addedSomething = 1 - if ( addedSomething ) - user.visible_message("\blue [user] load some items onto their service tray.") - - return - - // Unloads the tray, copied from base item's proc dropped() and altered - // see code\game\objects\items\weapons\kitchen.dm line 263 - - if ( isturf(target) || istype(target,/obj/structure/table) ) - var foundtable = istype(target,/obj/structure/table/) - if ( !foundtable ) //it must be a turf! - for(var/obj/structure/table/T in target) - foundtable = 1 - break - - var turf/dropspot - if ( !foundtable ) // don't unload things onto walls or other silly places. - dropspot = user.loc - else if ( isturf(target) ) // they clicked on a turf with a table in it - dropspot = target - else // they clicked on a table - dropspot = target.loc - - - overlays = null - - var droppedSomething = 0 - - for(var/obj/item/I in carrying) - I.loc = dropspot - carrying.Remove(I) - droppedSomething = 1 - if(!foundtable && isturf(dropspot)) - // if no table, presume that the person just shittily dropped the tray on the ground and made a mess everywhere! - spawn() - for(var/i = 1, i <= rand(1,2), i++) - if(I) - step(I, pick(NORTH,SOUTH,EAST,WEST)) - sleep(rand(2,4)) - if ( droppedSomething ) - if ( foundtable ) - user.visible_message("\blue [user] unloads their service tray.") - else - user.visible_message("\blue [user] drops all the items on their tray.") - - return ..() - - - - -// A special pen for service droids. Can be toggled to switch between normal writting mode, and paper rename mode +// A special pen for service droids. Can be toggled to switch between normal writing mode, and paper rename mode // Allows service droids to rename paper items. /obj/item/weapon/pen/robopen diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index 223f09daaa0..3666e7f8a71 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -217,7 +217,7 @@ src.modules += new /obj/item/device/flashlight(src) src.modules += new /obj/item/device/flash/cyborg(src) src.modules += new /obj/item/weapon/soap/nanotrasen(src) - src.modules += new /obj/item/weapon/storage/bag/trash(src) + src.modules += new /obj/item/weapon/storage/bag/trash/cyborg(src) src.modules += new /obj/item/weapon/mop(src) src.modules += new /obj/item/device/lightreplacer(src) src.modules += new /obj/item/weapon/holosign_creator(src) @@ -248,7 +248,7 @@ src.modules += new /obj/item/weapon/reagent_containers/robodropper(src) src.modules += new /obj/item/weapon/lighter/zippo(src) - src.modules += new /obj/item/weapon/tray/robotray(src) + src.modules += new /obj/item/weapon/storage/bag/tray/cyborg(src) src.modules += new /obj/item/weapon/reagent_containers/food/drinks/shaker(src) src.emag = new /obj/item/weapon/reagent_containers/food/drinks/cans/beer(src) diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index ce7af28cad7..6405b6ec3b6 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -207,7 +207,7 @@ !isturf(src.loc) || \ !(locate(/obj/structure/table) in src.loc) && \ !(locate(/obj/machinery/optable) in src.loc) && \ - !(locate(/obj/item/weapon/tray) in src.loc) \ + !(locate(/obj/item/weapon/storage/bag/tray) in src.loc) \ ) user << "\red You cannot slice [src] here! You need a table or at least a tray to do it." return 1