Fix trays (now bags)

This commit is contained in:
Markolie
2015-02-25 20:42:43 +01:00
parent 89650e8590
commit 6efa3bcdaa
8 changed files with 112 additions and 341 deletions
@@ -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
@@ -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)
@@ -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