Makes drinking glasses smash when thrown

This commit is contained in:
ShizCalev
2017-11-20 03:45:08 -05:00
committed by CitadelStationBot
parent ceda48865d
commit 831dde525e
8 changed files with 114 additions and 30 deletions
+1 -1
View File
@@ -349,7 +349,7 @@
var/injection_amount = 1
amount_per_transfer_from_this = 5
container_type = OPENCONTAINER_1
spillable = 0
spillable = FALSE
possible_transfer_amounts = list(5,10,15)
/obj/item/reagent_containers/chemtank/ui_action_click()
@@ -14,6 +14,7 @@
icon_state = "rag"
flags_1 = NOBLUDGEON_1
container_type = OPENCONTAINER_1
<<<<<<< HEAD
amount_per_transfer_from_this = 5
possible_transfer_amounts = list()
volume = 5
@@ -49,3 +50,40 @@
A.clean_blood()
A.wash_cream()
return
=======
amount_per_transfer_from_this = 5
possible_transfer_amounts = list()
volume = 5
spillable = FALSE
/obj/item/reagent_containers/glass/rag/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is smothering [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return (OXYLOSS)
/obj/item/reagent_containers/glass/rag/afterattack(atom/A as obj|turf|area, mob/user,proximity)
if(!proximity)
return
if(iscarbon(A) && A.reagents && reagents.total_volume)
var/mob/living/carbon/C = A
var/reagentlist = pretty_string_from_reagent_list(reagents)
if(user.a_intent == INTENT_HARM && !C.is_mouth_covered())
reagents.reaction(C, INGEST)
reagents.trans_to(C, reagents.total_volume)
C.visible_message("<span class='danger'>[user] has smothered \the [C] with \the [src]!</span>", "<span class='userdanger'>[user] has smothered you with \the [src]!</span>", "<span class='italics'>You hear some struggling and muffled cries of surprise.</span>")
log_game("[key_name(user)] smothered [key_name(A)] with a damp rag containing [reagentlist]")
log_attack("[key_name(user)] smothered [key_name(A)] with a damp rag containing [reagentlist]")
else
reagents.reaction(C, TOUCH)
reagents.clear_reagents()
log_game("[key_name(user)] touched [key_name(A)] with a damp rag containing [reagentlist]")
log_attack("[key_name(user)] touched [key_name(A)] with a damp rag containing [reagentlist]")
C.visible_message("<span class='notice'>[user] has touched \the [C] with \the [src].</span>")
else if(istype(A) && src in user)
user.visible_message("[user] starts to wipe down [A] with [src]!", "<span class='notice'>You start to wipe down [A] with [src]...</span>")
if(do_after(user,30, target = A))
user.visible_message("[user] finishes wiping off the [A]!", "<span class='notice'>You finish wiping off the [A].</span>")
A.clean_blood()
A.wash_cream()
return
>>>>>>> 02abe5d... Makes drinking glasses smash when thrown (#32890)
+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
@@ -5,7 +5,7 @@
icon = 'icons/obj/hydroponics/harvest.dmi'
icon_state = "honeycomb"
possible_transfer_amounts = list()
spillable = 0
spillable = FALSE
disease_amount = 0
volume = 10
amount_per_transfer_from_this = 0
+5 -2
View File
@@ -10,7 +10,7 @@
var/list/list_reagents = null
var/spawned_disease = null
var/disease_amount = 20
var/spillable = 0
var/spillable = FALSE
/obj/item/reagent_containers/Initialize(mapload, vol)
. = ..()
@@ -88,6 +88,9 @@
. = ..()
SplashReagents(target, TRUE)
/obj/item/reagent_containers/proc/bartender_check(atom/target)
return (target.CanPass(src, get_turf(src)) && thrownby && thrownby.mind && thrownby.mind.assigned_role == "Bartender")
/obj/item/reagent_containers/proc/SplashReagents(atom/target, thrown = FALSE)
if(!reagents || !reagents.total_volume || !spillable)
return
@@ -107,7 +110,7 @@
add_logs(thrownby, M, "splashed", R)
reagents.reaction(target, TOUCH)
else if((target.CanPass(src, get_turf(src))) && thrown && thrownby && thrownby.mind && thrownby.mind.assigned_role == "Bartender")
else if(bartender_check(target) && thrown)
visible_message("<span class='notice'>[src] lands onto the [target.name] without spilling a single drop.</span>")
return
@@ -4,7 +4,7 @@
possible_transfer_amounts = list(5, 10, 15, 20, 25, 30, 50)
volume = 50
container_type = OPENCONTAINER_1
spillable = 1
spillable = TRUE
resistance_flags = ACID_PROOF