diff --git a/code/modules/detectivework/footprints_and_rag.dm b/code/modules/detectivework/footprints_and_rag.dm index ee4f179e64..43f52e824b 100644 --- a/code/modules/detectivework/footprints_and_rag.dm +++ b/code/modules/detectivework/footprints_and_rag.dm @@ -45,13 +45,14 @@ remove_contents(user) /obj/item/weapon/reagent_containers/glass/rag/attackby(obj/item/W, mob/user) - var/obj/item/weapon/flame/F = W - if(!on_fire && istype(F) && F.lit) - ignite() - if(on_fire) - visible_message("\The [user] lights [src] with [W].") - else - user << "You manage to singe [src], but fail to light it." + if(!on_fire && istype(W, /obj/item/weapon/flame)) + var/obj/item/weapon/flame/F = W + if(F.lit) + ignite() + if(on_fire) + visible_message("\The [user] lights [src] with [W].") + else + user << "You manage to singe [src], but fail to light it." . = ..() update_name() @@ -69,6 +70,10 @@ icon_state = "raglit" else icon_state = "rag" + + var/obj/item/weapon/reagent_containers/food/drinks/bottle/B = loc + if(istype(B)) + B.update_icon() /obj/item/weapon/reagent_containers/glass/rag/proc/remove_contents(mob/user, atom/trans_dest = null) if(!trans_dest && !user.loc) @@ -146,6 +151,9 @@ /obj/item/weapon/reagent_containers/glass/rag/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature >= 50 + T0C) ignite() + if(exposed_temperature >= 900 + T0C) + new /obj/effect/decal/cleanable/ash(get_turf(src)) + qdel(src) //rag must have a minimum of 2 units welder fuel and at least 80% of the reagents must be welder fuel. //maybe generalize flammable reagents someday diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm index a99f2f24ea..c900f17bf8 100644 --- a/code/modules/lighting/lighting_atom.dm +++ b/code/modules/lighting/lighting_atom.dm @@ -21,6 +21,9 @@ if(.) update_light() +/atom/proc/copy_light(atom/A) + set_light(A.light_range, A.light_power, A.light_color) + /atom/proc/update_light() if(!light_power || !light_range) if(light) diff --git a/code/modules/reagents/reagent_containers/food/drinks/bottle.dm b/code/modules/reagents/reagent_containers/food/drinks/bottle.dm index e8c14f8de8..a73e73bc5a 100644 --- a/code/modules/reagents/reagent_containers/food/drinks/bottle.dm +++ b/code/modules/reagents/reagent_containers/food/drinks/bottle.dm @@ -9,31 +9,38 @@ 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 + + var/obj/item/weapon/reagent_containers/glass/rag/rag = null + var/rag_underlay = "rag" + +/obj/item/weapon/reagent_containers/food/drinks/bottle/Destroy() + rag = null + ..() //when thrown on impact, bottles smash and spill their contents /obj/item/weapon/reagent_containers/food/drinks/bottle/throw_impact(atom/hit_atom, var/speed) ..() var/mob/M = thrower - if(!isGlass && istype(M) && M.a_intent == I_HURT) + if(isGlass && 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) hit_atom.visible_message("The contents of the [src] splash all over [hit_atom]!") reagents.splash(hit_atom, reagents.total_volume) - src.smash(loc) + src.smash(loc, hit_atom) /obj/item/weapon/reagent_containers/food/drinks/bottle/proc/smash_check(var/distance) if(!isGlass || !smash_duration) return 0 - var/list/chance_table = list(90, 85, 85, 85, 65, 25) //starting from distance 0 + var/list/chance_table = list(90, 90, 85, 85, 60, 35, 15) //starting from distance 0 var/idx = max(distance + 1, 1) //since list indices start at 1 if(idx > chance_table.len) return 0 return prob(chance_table[idx]) -/obj/item/weapon/reagent_containers/food/drinks/bottle/proc/smash(var/newloc) +/obj/item/weapon/reagent_containers/food/drinks/bottle/proc/smash(var/newloc, atom/against = null) if(ismob(loc)) var/mob/M = loc M.drop_from_inventory(src) @@ -49,12 +56,61 @@ I.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0)) B.icon = I + if(rag && rag.on_fire && isliving(against)) + rag.forceMove(loc) + var/mob/living/L = against + L.IgniteMob() + playsound(src, "shatter", 70, 1) src.transfer_fingerprints_to(B) qdel(src) return B +/obj/item/weapon/reagent_containers/food/drinks/bottle/attackby(obj/item/W, mob/user) + if(!rag && istype(W, /obj/item/weapon/reagent_containers/glass/rag)) + insert_rag(W, user) + return + if(rag && istype(W, /obj/item/weapon/flame)) + rag.attackby(W, user) + return + ..() + +/obj/item/weapon/reagent_containers/food/drinks/bottle/attack_self(mob/user) + if(rag) + remove_rag(user) + else + ..() + +/obj/item/weapon/reagent_containers/food/drinks/bottle/proc/insert_rag(obj/item/weapon/reagent_containers/glass/rag/R, mob/user) + if(!isGlass || rag) return + if(user.unEquip(R)) + user << "You stuff [R] into [src]." + rag = R + rag.forceMove(src) + flags &= ~OPENCONTAINER + update_icon() + +/obj/item/weapon/reagent_containers/food/drinks/bottle/proc/remove_rag(mob/user) + if(!rag) return + user.put_in_hands(rag) + rag = null + flags |= (initial(flags) & OPENCONTAINER) + update_icon() + +/obj/item/weapon/reagent_containers/food/drinks/bottle/open(mob/user) + if(rag) return + ..() + +/obj/item/weapon/reagent_containers/food/drinks/bottle/update_icon() + underlays.Cut() + if(rag) + var/underlay_image = image(icon='icons/obj/drinks.dmi', icon_state=rag.on_fire? "[rag_underlay]_lit" : rag_underlay) + underlays += underlay_image + copy_light(rag) + else + set_light(0) + /obj/item/weapon/reagent_containers/food/drinks/bottle/attack(mob/living/target as mob, mob/living/user as mob) if(!target) return @@ -105,7 +161,7 @@ reagents.splash(target, reagents.total_volume) //Finally, smash the bottle. This kills (qdel) the bottle. - var/obj/item/weapon/broken_bottle/B = src.smash(target.loc) + var/obj/item/weapon/broken_bottle/B = src.smash(target.loc, target) user.put_in_active_hand(B) return @@ -345,6 +401,7 @@ volume = 50 smash_duration = 1 flags = 0 //starts closed + rag_underlay = "rag_small" /obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer name = "space beer" diff --git a/icons/obj/drinks.dmi b/icons/obj/drinks.dmi index 2db7f08f62..5d3b01eb1f 100644 Binary files a/icons/obj/drinks.dmi and b/icons/obj/drinks.dmi differ