Better Molotoovs (#11128)

Molotovs now work off both alcohol and welding fuel.
    Molotovs now longer emit light if an unlit rag is inserted.
    Molotov rags now properly delete when they burn out.
This commit is contained in:
Geeves
2021-02-06 17:45:37 +02:00
committed by GitHub
parent 81068d0f6b
commit afeb4a0849
3 changed files with 44 additions and 12 deletions
+22 -7
View File
@@ -208,10 +208,13 @@
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.
//rag must have a minimum of 2 units fuel and at least 80% of the reagents must be fuel.
//maybe generalize flammable reagents someday
/obj/item/reagent_containers/glass/rag/proc/can_ignite()
var/fuel = REAGENT_VOLUME(reagents, /decl/reagent/fuel)
var/fuel = 0
for(var/fuel_type in reagents.reagent_volumes)
if(ispath(fuel_type, /decl/reagent/fuel) || ispath(fuel_type, /decl/reagent/alcohol))
fuel += reagents.reagent_volumes[fuel_type]
return (fuel >= 2 && fuel >= reagents.total_volume*0.8)
/obj/item/reagent_containers/glass/rag/proc/ignite()
@@ -244,8 +247,13 @@
//ensures players always have a few seconds of burn time left when they light their rag
if(burn_time <= 5)
visible_message(SPAN_WARNING("\The [src] falls apart!"))
new /obj/effect/decal/cleanable/ash(get_turf(src))
qdel(src)
if(istype(loc, /obj/item/reagent_containers/food/drinks/bottle))
var/obj/item/reagent_containers/food/drinks/bottle/B = loc
B.delete_rag()
else
new /obj/effect/decal/cleanable/ash(get_turf(src))
qdel(src)
return
update_name()
update_icon()
@@ -264,11 +272,18 @@
if(burn_time <= 0)
STOP_PROCESSING(SSprocessing, src)
new /obj/effect/decal/cleanable/ash(location)
qdel(src)
if(istype(loc, /obj/item/reagent_containers/food/drinks/bottle))
var/obj/item/reagent_containers/food/drinks/bottle/B = loc
B.delete_rag()
else
new /obj/effect/decal/cleanable/ash(location)
qdel(src)
return
reagents.remove_reagent(/decl/reagent/fuel, reagents.maximum_volume/25)
for(var/fuel_type in reagents.reagent_volumes)
if(ispath(fuel_type, /decl/reagent/fuel) || ispath(fuel_type, /decl/reagent/alcohol))
reagents.remove_reagent(reagents.reagent_volumes[fuel_type], reagents.maximum_volume/25)
break
update_name()
update_icon()
burn_time--
@@ -101,12 +101,20 @@
update_icon()
/obj/item/reagent_containers/food/drinks/bottle/proc/remove_rag(mob/user)
if(!rag) return
if(!rag)
return
user.put_in_hands(rag)
rag = null
flags |= (initial(flags) & OPENCONTAINER)
update_icon()
/obj/item/reagent_containers/food/drinks/bottle/proc/delete_rag()
if(!rag)
return
QDEL_NULL(rag)
flags |= (initial(flags) & OPENCONTAINER)
update_icon()
/obj/item/reagent_containers/food/drinks/bottle/open(mob/user)
if(rag)
return
@@ -114,13 +122,14 @@
/obj/item/reagent_containers/food/drinks/bottle/update_icon()
underlays.Cut()
set_light(0)
if(rag)
var/underlay_image = image(icon='icons/obj/drinks.dmi', icon_state=rag.on_fire? "[rag_underlay]_lit" : rag_underlay)
underlays += underlay_image
set_light(2)
else
set_light(0)
..()
if(rag.on_fire)
set_light(2, l_color = LIGHT_COLOR_FIRE)
return
..()
/obj/item/reagent_containers/food/drinks/bottle/attack(mob/living/target, mob/living/user, var/hit_zone)
var/blocked = ..()