From cd9faeeebce2b5a5dd738e05186324ec11f08a01 Mon Sep 17 00:00:00 2001
From: Doxxmedearly <38594443+Doxxmedearly@users.noreply.github.com>
Date: Fri, 13 Mar 2020 07:04:04 -0500
Subject: [PATCH] Aiding the Food/Drink Refactor: Bottle Edition (#8408)
---
code/game/machinery/vending_types.dm | 14 ++--
code/modules/cargo/random_stock/t1_common.dm | 4 +-
.../reagents/reagent_containers/food/cans.dm | 2 +-
.../reagent_containers/food/drinks/bottle.dm | 74 +++++++++---------
html/changelogs/doxx - bottle refactor.yml | 17 ++++
icons/obj/drinks.dmi | Bin 122564 -> 122563 bytes
6 files changed, 64 insertions(+), 47 deletions(-)
create mode 100644 html/changelogs/doxx - bottle refactor.yml
diff --git a/code/game/machinery/vending_types.dm b/code/game/machinery/vending_types.dm
index 63c37a0313f..48590587337 100644
--- a/code/game/machinery/vending_types.dm
+++ b/code/game/machinery/vending_types.dm
@@ -65,14 +65,14 @@
/obj/item/reagent_containers/food/drinks/bottle/boukha = 2,
/obj/item/reagent_containers/food/drinks/bottle/small/beer = 6,
/obj/item/reagent_containers/food/drinks/bottle/small/ale = 6,
- /obj/item/reagent_containers/food/drinks/bottle/orangejuice = 4,
- /obj/item/reagent_containers/food/drinks/bottle/applejuice = 4,
- /obj/item/reagent_containers/food/drinks/bottle/tomatojuice = 4,
- /obj/item/reagent_containers/food/drinks/bottle/limejuice = 4,
- /obj/item/reagent_containers/food/drinks/bottle/lemonjuice = 4,
- /obj/item/reagent_containers/food/drinks/bottle/dynjuice = 4,
+ /obj/item/reagent_containers/food/drinks/bottle/carton/orangejuice = 4,
+ /obj/item/reagent_containers/food/drinks/bottle/carton/applejuice = 4,
+ /obj/item/reagent_containers/food/drinks/bottle/carton/tomatojuice = 4,
+ /obj/item/reagent_containers/food/drinks/bottle/carton/limejuice = 4,
+ /obj/item/reagent_containers/food/drinks/bottle/carton/lemonjuice = 4,
+ /obj/item/reagent_containers/food/drinks/bottle/carton/dynjuice = 4,
/obj/item/reagent_containers/food/drinks/cans/grape_juice = 6,
- /obj/item/reagent_containers/food/drinks/bottle/cream = 4,
+ /obj/item/reagent_containers/food/drinks/bottle/carton/cream = 4,
/obj/item/reagent_containers/food/drinks/cans/tonic = 8,
/obj/item/reagent_containers/food/drinks/bottle/cola = 5,
/obj/item/reagent_containers/food/drinks/bottle/space_up = 5,
diff --git a/code/modules/cargo/random_stock/t1_common.dm b/code/modules/cargo/random_stock/t1_common.dm
index 95c2b51514b..12ce8bd213c 100644
--- a/code/modules/cargo/random_stock/t1_common.dm
+++ b/code/modules/cargo/random_stock/t1_common.dm
@@ -388,8 +388,8 @@ STOCK_ITEM_COMMON(booze, 3.7)
else
new /obj/structure/reagent_dispensers/keg/xuizikeg(T)
else
- var/list/drinks = typesof(/obj/item/reagent_containers/food/drinks/bottle)
- drinks -= /obj/item/reagent_containers/food/drinks/bottle
+ var/list/drinks = subtypesof(/obj/item/reagent_containers/food/drinks/bottle)
+ drinks -= /obj/item/reagent_containers/food/drinks/bottle/carton
for (var/i in 1 to rand(1, 3))
var/type = pick(drinks)
diff --git a/code/modules/reagents/reagent_containers/food/cans.dm b/code/modules/reagents/reagent_containers/food/cans.dm
index 67795092486..5533ee68e62 100644
--- a/code/modules/reagents/reagent_containers/food/cans.dm
+++ b/code/modules/reagents/reagent_containers/food/cans.dm
@@ -113,7 +113,7 @@
icon_state = "tonic"
center_of_mass = list("x"=16, "y"=10)
-/obj/item/reagent_containers/food/drinks/cans/toni/Initialize()
+/obj/item/reagent_containers/food/drinks/cans/tonic/Initialize()
. = ..()
reagents.add_reagent("tonic", 50)
diff --git a/code/modules/reagents/reagent_containers/food/drinks/bottle.dm b/code/modules/reagents/reagent_containers/food/drinks/bottle.dm
index cbe84b48582..e1cc86aab60 100644
--- a/code/modules/reagents/reagent_containers/food/drinks/bottle.dm
+++ b/code/modules/reagents/reagent_containers/food/drinks/bottle.dm
@@ -2,6 +2,9 @@
//Functionally identical to regular drinks. The only difference is that the default bottle size is 100. - Darem
//Bottles now weaken and break when smashed on people's heads. - Giacom
+#define NO_EMPTY_ICON 1 //If icon does not have iconnamestate_empty as an empty state, use this flag to prevent it going invisible. See update_icon(). Remove this flag if you add empty states
+#define BOTTLE_IS_GLASS 2 //Whether the 'bottle' is made of glass or not so that milk cartons dont shatter when someone gets hit by it
+
/obj/item/reagent_containers/food/drinks/bottle
name = "empty bottle"
desc = "A sad empty bottle."
@@ -12,15 +15,15 @@
item_state = "broken_beer" //Generic held-item sprite until unique ones are made.
force = 5
var/smash_duration = 5 //Directly relates to the 'weaken' duration. Lowered by armor (i.e. helmets)
- var/isGlass = 1 //Whether the 'bottle' is made of glass or not so that milk cartons dont shatter when someone gets hit by it
matter = list("glass" = 800)
var/obj/item/reagent_containers/glass/rag/rag = null
var/rag_underlay = "rag"
+ var/bottle_flags = BOTTLE_IS_GLASS
/obj/item/reagent_containers/food/drinks/bottle/Initialize()
. = ..()
- if(isGlass)
+ if(bottle_flags & BOTTLE_IS_GLASS)
unacidable = 1
/obj/item/reagent_containers/food/drinks/bottle/Destroy()
@@ -38,7 +41,7 @@
..()
var/mob/M = thrower
- if(isGlass && istype(M) && M.a_intent == I_HURT)
+ if((bottle_flags & BOTTLE_IS_GLASS) && istype(M) && M.a_intent == I_HURT)
var/throw_dist = get_dist(throw_source, loc)
if(speed >= throw_speed && smash_check(throw_dist)) //not as reliable as smashing directly
if(reagents)
@@ -47,7 +50,7 @@
src.smash(loc, hit_atom)
/obj/item/reagent_containers/food/drinks/bottle/proc/smash_check(var/distance)
- if(!isGlass || !smash_duration)
+ if(!(bottle_flags & BOTTLE_IS_GLASS) || !smash_duration)
return 0
var/list/chance_table = list(90, 90, 85, 85, 60, 35, 15) //starting from distance 0
@@ -99,7 +102,8 @@
..()
/obj/item/reagent_containers/food/drinks/bottle/proc/insert_rag(obj/item/reagent_containers/glass/rag/R, mob/user)
- if(!isGlass || rag) return
+ if(!(bottle_flags & BOTTLE_IS_GLASS) || rag)
+ return
if(user.unEquip(R))
to_chat(user, "You stuff [R] into [src].")
rag = R
@@ -127,10 +131,10 @@
set_light(2)
else
set_light(0)
- if(reagents.total_volume)
- icon_state = "[initial(icon_state)]"
- else
+ if(!reagents.total_volume && !(bottle_flags & NO_EMPTY_ICON))
icon_state = "[initial(icon_state)]_empty"
+ else
+ icon_state = "[initial(icon_state)]"
/obj/item/reagent_containers/food/drinks/bottle/attack(mob/living/target, mob/living/user, var/hit_zone)
var/blocked = ..()
@@ -377,6 +381,7 @@
desc = "A bottle of 46 proof Emeraldine Melon Liquor. Sweet and light."
icon_state = "alco-green" //Placeholder.
center_of_mass = list("x"=16, "y"=6)
+ bottle_flags = BOTTLE_IS_GLASS | NO_EMPTY_ICON
Initialize()
. = ..()
reagents.add_reagent("melonliquor", 100)
@@ -385,6 +390,7 @@
name = "Miss blue curacao"
desc = "A fruity, exceptionally azure drink. Does not allow the imbiber to use the fifth magic."
icon_state = "alco-blue" //Placeholder.
+ bottle_flags = BOTTLE_IS_GLASS | NO_EMPTY_ICON
center_of_mass = list("x"=16, "y"=6)
Initialize()
. = ..()
@@ -394,6 +400,7 @@
name = "Briar Rose grenadine syrup"
desc = "Sweet and tangy, a bar syrup used to add color or flavor to drinks."
icon_state = "grenadinebottle"
+ bottle_flags = BOTTLE_IS_GLASS | NO_EMPTY_ICON
center_of_mass = list("x"=16, "y"=6)
Initialize()
. = ..()
@@ -404,6 +411,8 @@
desc = "Cola. in space"
icon_state = "colabottle"
center_of_mass = list("x"=16, "y"=6)
+ bottle_flags = NO_EMPTY_ICON
+ drop_sound = 'sound/items/drop/shoes.ogg'
Initialize()
. = ..()
reagents.add_reagent("cola", 100)
@@ -413,6 +422,8 @@
desc = "Tastes like a hull breach in your mouth."
icon_state = "space-up_bottle"
center_of_mass = list("x"=16, "y"=6)
+ bottle_flags = NO_EMPTY_ICON
+ drop_sound = 'sound/items/drop/shoes.ogg'
Initialize()
..()
reagents.add_reagent("space_up", 100)
@@ -422,6 +433,8 @@
desc = "Blows right through you like a space wind."
icon_state = "space_mountain_wind_bottle"
center_of_mass = list("x"=16, "y"=6)
+ bottle_flags = NO_EMPTY_ICON
+ drop_sound = 'sound/items/drop/shoes.ogg'
Initialize()
. = ..()
reagents.add_reagent("spacemountainwind", 100)
@@ -437,79 +450,66 @@
//////////////////////////JUICES AND STUFF ///////////////////////
-/obj/item/reagent_containers/food/drinks/bottle/orangejuice
+/obj/item/reagent_containers/food/drinks/bottle/carton
+ name = "carton"
+ desc = "An abstract way to organize bottles that are really cartons. Finally!"
+ bottle_flags = NO_EMPTY_ICON
+ item_state = "carton"
+ center_of_mass = list("x"=16, "y"=6)
+ drop_sound = 'sound/items/drop/box.ogg'
+
+/obj/item/reagent_containers/food/drinks/bottle/carton/orangejuice
name = "orange juice"
desc = "Full of vitamins and deliciousness!"
icon_state = "orangejuice"
- item_state = "carton"
- center_of_mass = list("x"=16, "y"=6)
- isGlass = 0
Initialize()
. = ..()
reagents.add_reagent("orangejuice", 100)
-/obj/item/reagent_containers/food/drinks/bottle/cream
+/obj/item/reagent_containers/food/drinks/bottle/carton/cream
name = "milk cream"
desc = "It's cream. Made from milk. What else did you think you'd find in there?"
icon_state = "cream"
- item_state = "carton"
- center_of_mass = list("x"=16, "y"=6)
- isGlass = 0
Initialize()
. = ..()
reagents.add_reagent("cream", 100)
-/obj/item/reagent_containers/food/drinks/bottle/tomatojuice
+/obj/item/reagent_containers/food/drinks/bottle/carton/tomatojuice
name = "tomato juice"
desc = "Well, at least it LOOKS like tomato juice. You can't tell with all that redness."
icon_state = "tomatojuice"
- item_state = "carton"
- center_of_mass = list("x"=16, "y"=6)
- isGlass = 0
Initialize()
. = ..()
reagents.add_reagent("tomatojuice", 100)
-/obj/item/reagent_containers/food/drinks/bottle/limejuice
+/obj/item/reagent_containers/food/drinks/bottle/carton/limejuice
name = "lime juice"
desc = "Sweet-sour goodness."
icon_state = "limejuice"
- item_state = "carton"
- center_of_mass = list("x"=16, "y"=4)
- isGlass = 0
Initialize()
. = ..()
reagents.add_reagent("limejuice", 100)
-/obj/item/reagent_containers/food/drinks/bottle/lemonjuice
+/obj/item/reagent_containers/food/drinks/bottle/carton/lemonjuice
name = "lemon juice"
desc = "This juice is VERY sour."
icon_state = "lemoncarton"
- item_state = "carton"
- center_of_mass = list("x"=16, "y"=6)
- isGlass = 0
Initialize()
. = ..()
reagents.add_reagent("lemonjuice", 100)
-/obj/item/reagent_containers/food/drinks/bottle/dynjuice
+/obj/item/reagent_containers/food/drinks/bottle/carton/dynjuice
name = "dyn juice"
desc = "Juice from a Skrell medicinal herb. It's supposed to be diluted."
icon_state = "dyncarton"
- item_state = "carton"
- center_of_mass = list("x"=16, "y"=6)
- isGlass = 0
Initialize()
. = ..()
reagents.add_reagent("dynjuice", 100)
-/obj/item/reagent_containers/food/drinks/bottle/applejuice
+/obj/item/reagent_containers/food/drinks/bottle/carton/applejuice
name = "apple juice"
desc = "Juice from an apple. Yes."
icon_state = "applejuice"
- item_state = "carton"
- center_of_mass = list("x"=16, "y"=4)
- isGlass = 0
Initialize()
. = ..()
reagents.add_reagent("applejuice", 100)
@@ -671,4 +671,4 @@
center_of_mass = list("x"=16, "y"=4)
Initialize()
. = ..()
- reagents.add_reagent("whitewine", 100)
\ No newline at end of file
+ reagents.add_reagent("whitewine", 100)
diff --git a/html/changelogs/doxx - bottle refactor.yml b/html/changelogs/doxx - bottle refactor.yml
new file mode 100644
index 00000000000..9f0eccb0616
--- /dev/null
+++ b/html/changelogs/doxx - bottle refactor.yml
@@ -0,0 +1,17 @@
+
+# Your name.
+author: Doxxmedearly
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
+# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - bugfix: "Fixed some invisible bottle sprites."
+ - bugfix: "T-borg tonic water cans no longer spawn empty."
+ - tweak: "Carton dropsounds tweaked to be less like glass and more like cardboard."
+ - tweak: "Large soda bottles vended from the booze-o-mat now behave like plastic bottles instead of glass ones."
diff --git a/icons/obj/drinks.dmi b/icons/obj/drinks.dmi
index 4a1a353f6aac57df68e2a7346dc9cc02967f4352..a08654d155dca70d1861877716ba5e89b0b82a6c 100644
GIT binary patch
delta 1854
zcmV-E2f_Hny$8d+2aqHIx3MLs1Ao$YD5!r=WKERiojn1QPqO|VF>y`eY6@U0)1b>a
znpV2Xge1Q~n6Z=~m4RFvCE&)LZZ^!wK~BhK%h>};S9IS*sudp48FQ{oDBcAU6g!j%
zi=_=u3t!%%X(~Z7!jMvt%MDr^r*1jtJOMWw2BL-%n}BF)B-ev7CkGD0Zhwr10fjX~
zSm)kcAG^GiWm=tZ55WRf1ORa=J(bb;`O(rKAy!
z-_Yn#9Aj%0$9{S@m+TF*vVRj6yNC%p#d;vPHQfQFpm*#&2u56(35oeI6LxY9K`;#i
zmJ_a;#bH;sRo~ME_#IWY#1U|NyP}>jse?+<+_Kpobdx!0hRTC3sMAOlRb|N=d3nLW
zk&|Zfpy)R=2E5=Lz%!QI!%Ju>Q(ku79GPjwmMV^YWl$jw71##D|9|h3Rsz&$&Z_9(
zn767ghCZ}KVDJlGL2<@AZ?a_rwcBU_W5%Jx#swxIB%m1ENUpcB6afnHnj~ofv@7Y8
z)MX>wlCL@f#dp~a{xL?nH=9w4mkc@}Ckoh4*?w0cd;LQz^`!{>F9QSI-
z#c7O^5lv^#vlKOE+@?}6Y$>+tdyvrH%2Ocyjp?ElJ4GeG4!}+G@qlH2NlZ#`#)R*o
z@+)_MPRnb(5+u|aH(?`sF)9N)p%Y==x%jD#l08a=POTqw7=M8G_xe_rLsT(tDMoCo
zNn#YuB*sNYpmijU+=?yx!aK>8td(&E@L)938syzexJxdj`8ZMTJapE3ugn(AJYh*{h22_(IqqLT!>@e;PA4~
zUK~|!H7&Ool7AC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