Makes drinking glasses smash when thrown

This commit is contained in:
ShizCalev
2017-11-20 02:45:22 -06:00
committed by CitadelStationBot
parent ceda48865d
commit 831dde525e
8 changed files with 114 additions and 30 deletions
+52 -6
View File
@@ -13,6 +13,7 @@
possible_transfer_amounts = list(5,10,15,20,25,30,50)
volume = 50
resistance_flags = 0
var/isGlass = TRUE //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/on_reagent_change()
if (gulp_size < 5)
@@ -98,7 +99,27 @@
reagents.handle_reactions()
..()
/obj/item/reagent_containers/food/drinks/throw_impact(atom/target, mob/thrower)
. = ..()
if(!.) //if the bottle wasn't caught
smash(target, thrower, TRUE)
/obj/item/reagent_containers/food/drinks/proc/smash(atom/target, mob/thrower, ranged = FALSE)
if(!isGlass)
return
if(bartender_check(target) && ranged)
return
var/obj/item/broken_bottle/B = new (loc)
B.icon_state = icon_state
var/icon/I = new('icons/obj/drinks.dmi', src.icon_state)
I.Blend(B.broken_outline, ICON_OVERLAY, rand(5), 1)
I.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0))
B.icon = I
if(prob(33))
new/obj/item/shard(drop_location())
playsound(src, "shatter", 70, 1)
transfer_fingerprints_to(B)
qdel(src)
@@ -121,8 +142,9 @@
volume = 5
flags_1 = CONDUCT_1
container_type = OPENCONTAINER_1
spillable = 1
spillable = TRUE
resistance_flags = FIRE_PROOF
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/trophy/gold_cup
name = "gold cup"
@@ -168,22 +190,24 @@
desc = "Careful, the beverage you're about to enjoy is extremely hot."
icon_state = "coffee"
list_reagents = list("coffee" = 30)
spillable = 1
spillable = TRUE
resistance_flags = FREEZE_PROOF
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/ice
name = "Ice Cup"
desc = "Careful, cold ice, do not chew."
icon_state = "coffee"
list_reagents = list("ice" = 30)
spillable = 1
spillable = TRUE
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/mug/ // parent type is literally just so empty mug sprites are a thing
name = "mug"
desc = "A drink served in a classy mug."
icon_state = "tea"
item_state = "coffee"
spillable = 1
spillable = TRUE
/obj/item/reagent_containers/food/drinks/mug/on_reagent_change()
if(reagents.total_volume)
@@ -211,6 +235,7 @@
icon_state = "ramen"
list_reagents = list("dry_ramen" = 30)
foodtype = GRAIN
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/beer
name = "Space Beer"
@@ -233,7 +258,8 @@
icon_state = "water_cup_e"
possible_transfer_amounts = list()
volume = 10
spillable = 1
spillable = TRUE
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/sillycup/on_reagent_change()
if(reagents.total_volume)
@@ -247,6 +273,22 @@
icon_state = "juicebox"
volume = 15 //I figure if you have to craft these it should at least be slightly better than something you can get for free from a watercooler
/obj/item/reagent_containers/food/drinks/sillycup/smallcarton/smash(atom/target, mob/thrower, ranged = FALSE)
if(bartender_check(target) && ranged)
return
var/obj/item/broken_bottle/B = new (loc)
B.icon_state = icon_state
var/icon/I = new('icons/obj/drinks.dmi', src.icon_state)
I.Blend(B.broken_outline, ICON_OVERLAY, rand(5), 1)
I.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0))
B.icon = I
B.name = "broken carton"
B.force = 0
B.throwforce = 0
B.desc = "A carton with the bottom half burst open. Might give you a papercut."
transfer_fingerprints_to(B)
qdel(src)
/obj/item/reagent_containers/food/drinks/sillycup/smallcarton/on_reagent_change()
if (reagents.reagent_list.len)
switch(reagents.get_master_reagent_id())
@@ -299,6 +341,7 @@
materials = list(MAT_METAL=1500)
amount_per_transfer_from_this = 10
volume = 100
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/flask
name = "flask"
@@ -306,6 +349,7 @@
icon_state = "flask"
materials = list(MAT_METAL=250)
volume = 60
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/flask/gold
name = "captain's flask"
@@ -324,7 +368,7 @@
desc = "A cup with the british flag emblazoned on it."
icon_state = "britcup"
volume = 30
spillable = 1
spillable = TRUE
///Lavaland bowls and bottles///
@@ -335,6 +379,7 @@
icon_state = "mushroom_bowl"
w_class = WEIGHT_CLASS_SMALL
resistance_flags = 0
isGlass = FALSE
//////////////////////////soda_cans//
@@ -346,6 +391,7 @@
righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi'
container_type = NONE
spillable = FALSE
isGlass = FALSE
/obj/item/reagent_containers/food/drinks/soda_cans/attack(mob/M, mob/user)
if(M == user && !src.reagents.total_volume && user.a_intent == INTENT_HARM && user.zone_selected == "head")
@@ -12,21 +12,18 @@
lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi'
var/const/duration = 13 //Directly relates to the 'knockdown' 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
isGlass = TRUE
foodtype = ALCOHOL
/obj/item/reagent_containers/food/drinks/bottle/throw_impact(atom/target,mob/thrower)
..()
smash(target,thrower,1)
/obj/item/reagent_containers/food/drinks/bottle/proc/smash(mob/living/target, mob/living/user, ranged = 0)
/obj/item/reagent_containers/food/drinks/bottle/smash(mob/living/target, mob/thrower, ranged = FALSE)
//Creates a shattering noise and replaces the bottle with a broken_bottle
var/new_location = get_turf(src)
var/obj/item/broken_bottle/B = new /obj/item/broken_bottle(new_location)
if(bartender_check(target) && ranged)
return
var/obj/item/broken_bottle/B = new (loc)
if(!ranged)
user.put_in_hands(B)
B.icon_state = src.icon_state
thrower.put_in_hands(B)
B.icon_state = icon_state
var/icon/I = new('icons/obj/drinks.dmi', src.icon_state)
I.Blend(B.broken_outline, ICON_OVERLAY, rand(5), 1)
@@ -35,14 +32,14 @@
if(isGlass)
if(prob(33))
new/obj/item/shard(new_location)
new/obj/item/shard(drop_location())
playsound(src, "shatter", 70, 1)
else
B.name = "broken carton"
B.force = 0
B.throwforce = 0
B.desc = "A carton with the bottom half burst open. Might give you a papercut."
src.transfer_fingerprints_to(B)
transfer_fingerprints_to(B)
qdel(src)
@@ -116,7 +113,7 @@
SplashReagents(target)
//Finally, smash the bottle. This kills (del) the bottle.
src.smash(target, user)
smash(target, user)
return
@@ -311,7 +308,7 @@
item_state = "carton"
lefthand_file = 'icons/mob/inhands/equipment/kitchen_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/kitchen_righthand.dmi'
isGlass = 0
isGlass = FALSE
list_reagents = list("orangejuice" = 100)
foodtype = FRUIT
@@ -322,7 +319,7 @@
item_state = "carton"
lefthand_file = 'icons/mob/inhands/equipment/kitchen_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/kitchen_righthand.dmi'
isGlass = 0
isGlass = FALSE
list_reagents = list("cream" = 100)
foodtype = DAIRY
@@ -333,7 +330,7 @@
item_state = "carton"
lefthand_file = 'icons/mob/inhands/equipment/kitchen_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/kitchen_righthand.dmi'
isGlass = 0
isGlass = FALSE
list_reagents = list("tomatojuice" = 100)
foodtype = VEGETABLES
@@ -344,7 +341,7 @@
item_state = "carton"
lefthand_file = 'icons/mob/inhands/equipment/kitchen_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/kitchen_righthand.dmi'
isGlass = 0
isGlass = FALSE
list_reagents = list("limejuice" = 100)
foodtype = FRUIT
@@ -367,7 +364,7 @@
B.reagents.copy_to(src,100)
if(!B.isGlass)
desc += " You're not sure if making this out of a carton was the brightest idea."
isGlass = 0
isGlass = FALSE
return
/obj/item/reagent_containers/food/drinks/bottle/molotov/throw_impact(atom/target,mob/thrower)
@@ -8,7 +8,7 @@
volume = 50
materials = list(MAT_GLASS=500)
max_integrity = 20
spillable = 1
spillable = TRUE
resistance_flags = ACID_PROOF
unique_rename = 1