Aiding the Food/Drink Refactor: Bottle Edition (#8408)

This commit is contained in:
Doxxmedearly
2020-03-13 07:04:04 -05:00
committed by GitHub
parent 405ae34350
commit cd9faeeebc
6 changed files with 64 additions and 47 deletions
+7 -7
View File
@@ -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,
+2 -2
View File
@@ -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)
@@ -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)
@@ -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, "<span class='notice'>You stuff [R] into [src].</span>")
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)
reagents.add_reagent("whitewine", 100)
@@ -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."
Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB