From 5699306cf3dfc9321ea0de96de74b7dd4c403ca9 Mon Sep 17 00:00:00 2001 From: Datraen Date: Thu, 7 Jan 2016 20:31:05 -0500 Subject: [PATCH 1/3] Trays now drop items properly --- code/game/objects/items/weapons/trays.dm | 37 ++++++++++++------------ 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/code/game/objects/items/weapons/trays.dm b/code/game/objects/items/weapons/trays.dm index d4a7117bbb4..e21ede24181 100644 --- a/code/game/objects/items/weapons/trays.dm +++ b/code/game/objects/items/weapons/trays.dm @@ -192,24 +192,23 @@ /obj/item/weapon/tray/dropped(mob/user) - var/mob/living/M - for(M in src.loc) //to handle hand switching - return + spawn(1) + if(istype(loc,/mob/living)) //to handle hand switching + return - var/foundtable = 0 - for(var/obj/structure/table/T in loc) - foundtable = 1 - break + var/foundtable = 0 + for(var/obj/structure/table/T in src.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)) + 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)) \ No newline at end of file From 67a318327c43626858bd090c2dd160b1b0129292 Mon Sep 17 00:00:00 2001 From: Datraen Date: Thu, 7 Jan 2016 20:32:14 -0500 Subject: [PATCH 2/3] Adds changelog. --- html/changelogs/Datraen-Trayfix.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 html/changelogs/Datraen-Trayfix.yml diff --git a/html/changelogs/Datraen-Trayfix.yml b/html/changelogs/Datraen-Trayfix.yml new file mode 100644 index 00000000000..f32b86dbf93 --- /dev/null +++ b/html/changelogs/Datraen-Trayfix.yml @@ -0,0 +1,4 @@ +author: Datraen +delete-after: True +changes: + - bugfix: "Trays now drop items when placed on table, dropped." From 460075b3603f36007f48914ed9dc160ba2712589 Mon Sep 17 00:00:00 2001 From: Datraen Date: Thu, 14 Jan 2016 18:29:49 -0500 Subject: [PATCH 3/3] Slight optimization in dropped, adds colors to material items. --- code/game/objects/items/weapons/trays.dm | 42 +++++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/code/game/objects/items/weapons/trays.dm b/code/game/objects/items/weapons/trays.dm index e21ede24181..624b6fcb980 100644 --- a/code/game/objects/items/weapons/trays.dm +++ b/code/game/objects/items/weapons/trays.dm @@ -185,30 +185,32 @@ add = 5 if(calc_carry() + add >= max_carry) break - + var/image/Img = new(src.icon) I.loc = src carrying.Add(I) - overlays += image("icon" = I.icon, "icon_state" = I.icon_state, "layer" = 30 + I.layer) + Img.icon = I.icon + Img.icon_state = I.icon_state + Img.layer = 30 + I.layer + if(istype(I, /obj/item/weapon/material)) + var/obj/item/weapon/material/O = I + if(O.applies_material_colour) + Img.color = O.color + overlays += Img /obj/item/weapon/tray/dropped(mob/user) - - spawn(1) - if(istype(loc,/mob/living)) //to handle hand switching - return - - var/foundtable = 0 - for(var/obj/structure/table/T in src.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() + var/noTable = null + + spawn() //Allows the tray to udpate location, rather than just checking against mob's location + if(isturf(src.loc) && !(locate(/obj/structure/table) in src.loc)) + noTable = 1 + + if(isturf(loc) && !(locate(/mob/living) in src.loc)) + overlays.Cut() + for(var/obj/item/I in carrying) + I.forceMove(src.loc) + carrying.Remove(I) + if(noTable) for(var/i = 1, i <= rand(1,2), i++) if(I) step(I, pick(NORTH,SOUTH,EAST,WEST)) - sleep(rand(2,4)) \ No newline at end of file + sleep(rand(2,4))