Refactors is_hot and fixes some issues from the beaker lighting PR (#22964)

* Idk what I'm doing

* The is_hot refactor

* Fixes that I forgot to push before making the PR

* Update code/game/objects/items.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Contra review

* TODO: Find out why this isn't working

* Removes the signal stuff for now, this works

* Fixes it all

* Add new signal

* Update code/_onclick/item_attack.dm

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>

* Contra reivew

* Ayyy it works

* Merge master

* Forgot this one

* Update code/game/machinery/doors/airlock_types.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/game/objects/structures/mineral_doors.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/game/turfs/simulated/floor/mineral_floors.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/game/turfs/simulated/walls_mineral.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

---------

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
This commit is contained in:
DGamerL
2023-12-11 16:53:51 +00:00
committed by GitHub
co-authored by Burzah Contrabang
parent cbc45c1336
commit 004d7d10b7
29 changed files with 77 additions and 84 deletions
+2
View File
@@ -564,6 +564,8 @@
///from base of obj/item/pre_attack(): (atom/target, mob/user, params)
#define COMSIG_ITEM_PRE_ATTACK "item_pre_attack"
#define COMPONENT_NO_ATTACK (1<<0)
///from base of obj/item/pre_attack(): (atom/target, mob/user, params)
#define COMSIG_ITEM_BEING_ATTACKED "item_being_attacked"
///from base of obj/item/afterattack(): (atom/target, mob/user, params)
#define COMSIG_ITEM_AFTERATTACK "item_afterattack"
///from base of obj/item/attack_qdeleted(): (atom/target, mob/user, params)
-49
View File
@@ -1171,55 +1171,6 @@ GLOBAL_LIST_INIT(can_embed_types, typecacheof(list(
if(is_type_in_typecache(W, GLOB.can_embed_types))
return 1
/proc/is_hot(obj/item/W as obj)
if(W.tool_behaviour == TOOL_WELDER)
if(W.tool_enabled)
return 2500
else
return 0
if(istype(W, /obj/item/lighter))
var/obj/item/lighter/O = W
if(O.lit)
return 1500
else
return 0
if(istype(W, /obj/item/match))
var/obj/item/match/O = W
if(O.lit)
return 1000
else
return 0
if(istype(W, /obj/item/clothing/mask/cigarette))
var/obj/item/clothing/mask/cigarette/O = W
if(O.lit)
return 1000
else
return 0
if(istype(W, /obj/item/candle))
var/obj/item/candle/O = W
if(O.lit)
return 1000
else
return 0
if(istype(W, /obj/item/flashlight/flare))
var/obj/item/flashlight/flare/O = W
if(O.on)
return 1000
else
return 0
if(istype(W, /obj/item/gun/energy/plasmacutter))
return 3800
if(istype(W, /obj/item/melee/energy))
var/obj/item/melee/energy/O = W
if(O.active)
return 3500
else
return 0
if(istype(W, /obj/item/assembly/igniter))
return 20000
else
return 0
//Whether or not the given item counts as sharp in terms of dealing damage
/proc/is_sharp(obj/O)
if(!O)
+8 -3
View File
@@ -26,12 +26,17 @@
/obj/item/proc/pre_attack(atom/A, mob/living/user, params) //do stuff before attackby!
if(SEND_SIGNAL(src, COMSIG_ITEM_PRE_ATTACK, A, user, params) & COMPONENT_CANCEL_ATTACK_CHAIN)
return TRUE
if(is_hot(src) && A.reagents && !ismob(A))
if(SEND_SIGNAL(A, COMSIG_ITEM_BEING_ATTACKED, src, user, params) & COMPONENT_CANCEL_ATTACK_CHAIN)
return TRUE
var/temperature = get_heat()
if(temperature && A.reagents && !ismob(A) && !istype(A, /obj/item/clothing/mask/cigarette))
var/reagent_temp = A.reagents.chem_temp
var/time = (reagent_temp / 10) / (is_hot(src) / 1000)
var/time = (reagent_temp / 10) / (temperature / 1000)
if(do_after_once(user, time, TRUE, user, TRUE, attempt_cancel_message = "You stop heating up [A]."))
to_chat(user, "<span class='notice'>You heat [A] with [src].</span>")
A.reagents.temperature_reagents(is_hot(src))
A.reagents.temperature_reagents(temperature)
return TRUE //return FALSE to avoid calling attackby after this proc does stuff
// No comment
+4 -4
View File
@@ -201,12 +201,12 @@
DA.update_name()
qdel(src)
/obj/machinery/door/airlock/plasma/attackby(obj/C, mob/user, params)
if(is_hot(C) > 300)
message_admins("Plasma airlock ignited by [key_name_admin(user)] in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
/obj/machinery/door/airlock/plasma/attackby(obj/item/C, mob/user, params)
if(C.get_heat() > 300)
message_admins("Plasma airlock ignited by [key_name_admin(user)] in ([x],[y],[z] - <a href='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
log_game("Plasma airlock ignited by [key_name(user)] in ([x],[y],[z])")
investigate_log("was <font color='red'><b>ignited</b></font> by [key_name(user)]","atmos")
ignite(is_hot(C))
ignite(C.get_heat())
else
return ..()
+4 -2
View File
@@ -133,7 +133,6 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
/// Holder var for the item outline filter, null when no outline filter on the item.
var/outline_filter
/obj/item/New()
..()
@@ -646,7 +645,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
if(w_class < WEIGHT_CLASS_BULKY)
itempush = FALSE //too light to push anything
if(isliving(hit_atom)) //Living mobs handle hit sounds differently.
if(is_hot(src))
if(get_heat())
var/mob/living/L = hit_atom
L.IgniteMob()
var/volume = get_volume_by_throwforce_and_or_w_class()
@@ -902,3 +901,6 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
H.regenerate_icons()
/obj/item/proc/get_heat()
return
+4 -1
View File
@@ -42,7 +42,7 @@
return TRUE
/obj/item/candle/attackby(obj/item/W, mob/user, params)
if(is_hot(W))
if(W.get_heat())
light("<span class='notice'>[user] lights [src] with [W].</span>")
return
return ..()
@@ -152,6 +152,9 @@
infinite = FALSE
wax = 1 // next process will burn it out
/obj/item/candle/get_heat()
return lit * 1000
#undef TALL_CANDLE
#undef MID_CANDLE
#undef SHORT_CANDLE
@@ -230,6 +230,9 @@
return TRUE
return ..()
/obj/item/flashlight/flare/get_heat()
return produce_heat * on * 1000
// GLOWSTICKS
/obj/item/flashlight/flare/glowstick
+2 -2
View File
@@ -13,7 +13,7 @@
/obj/item/flag/attackby(obj/item/W, mob/user, params)
. = ..()
if(is_hot(W) && !(resistance_flags & ON_FIRE))
if(W.get_heat() && !(resistance_flags & ON_FIRE))
user.visible_message("<span class='notice'>[user] lights [src] with [W].</span>", "<span class='notice'>You light [src] with [W].</span>", "<span class='warning'>You hear a low whoosh.</span>")
fire_act()
@@ -259,7 +259,7 @@
log_game("[key_name(user)] has hidden [I] in [src] ready for detonation at [A.name] ([bombturf.x],[bombturf.y],[bombturf.z]).")
investigate_log("[key_name(user)] has hidden [I] in [src] ready for detonation at [A.name] ([bombturf.x],[bombturf.y],[bombturf.z]).", INVESTIGATE_BOMB)
add_attack_logs(user, src, "has hidden [I] ready for detonation in", ATKLOG_MOST)
else if(is_hot(I) && !(resistance_flags & ON_FIRE) && boobytrap && trapper)
else if(I.get_heat() && !(resistance_flags & ON_FIRE) && boobytrap && trapper)
var/turf/bombturf = get_turf(src)
var/area/A = get_area(bombturf)
log_game("[key_name_admin(user)] has lit [src] trapped with [boobytrap] by [key_name_admin(trapper)] at [A.name] ([bombturf.x],[bombturf.y],[bombturf.z]).")
+1 -1
View File
@@ -61,5 +61,5 @@
var/obj/item/tank/T = W
blow(T, user)
return
if(is_sharp(W) || is_hot(W) || is_pointed(W))
if(is_sharp(W) || W.get_heat() || is_pointed(W))
burst()
@@ -264,7 +264,7 @@ GLOBAL_LIST_INIT(sandbag_recipes, list (
return TRUE
/obj/item/stack/sheet/mineral/plasma/attackby(obj/item/I, mob/living/user, params)
if(is_hot(I))
if(I.get_heat())
log_and_set_aflame(user, I)
else
return ..()
+3
View File
@@ -207,6 +207,9 @@
if(reagents.check_and_add("fuel", maximum_fuel, 2 * coeff))
update_icon()
/obj/item/weldingtool/get_heat()
return tool_enabled * 2500
/obj/item/weldingtool/largetank
name = "industrial welding tool"
desc = "A slightly larger welder with a larger tank."
+9
View File
@@ -47,12 +47,19 @@ LIGHTERS ARE IN LIGHTERS.DM
reagents.set_reacting(FALSE) // so it doesn't react until you light it
if(list_reagents)
reagents.add_reagent_list(list_reagents)
RegisterSignal(src, COMSIG_ITEM_BEING_ATTACKED, PROC_REF(can_light))
/obj/item/clothing/mask/cigarette/Destroy()
QDEL_NULL(reagents)
STOP_PROCESSING(SSobj, src)
return ..()
/obj/item/clothing/mask/cigarette/proc/can_light(obj/item/cigarette, obj/item/lighting_item)
SIGNAL_HANDLER
if(lighting_item.get_heat())
light()
return COMPONENT_CANCEL_ATTACK_CHAIN
/obj/item/clothing/mask/cigarette/decompile_act(obj/item/matter_decompiler/C, mob/user)
if(isdrone(user))
C.stored_comms["wood"] += 1
@@ -250,6 +257,8 @@ LIGHTERS ARE IN LIGHTERS.DM
STOP_PROCESSING(SSobj, src)
qdel(src)
/obj/item/clothing/mask/cigarette/get_heat()
return lit * 1000
/obj/item/clothing/mask/cigarette/menthol
list_reagents = list("nicotine" = 40, "menthol" = 20)
@@ -125,6 +125,9 @@
item_state = "[initial(item_state)][lit ? "-on" : ""]"
return ..()
/obj/item/lighter/get_heat()
return lit * 1500
// Zippo lighters
/obj/item/lighter/zippo
name = "zippo lighter"
@@ -304,6 +307,9 @@
if(istype(mask_item, /obj/item/clothing/mask/cigarette))
return mask_item
/obj/item/match/get_heat()
return lit * 1000
/obj/item/match/firebrand
name = "firebrand"
desc = "An unlit firebrand. It makes you wonder why it's not just called a stick."
@@ -85,6 +85,9 @@
add_fingerprint(user)
return
/obj/item/melee/energy/get_heat()
return active * 3500
/obj/item/melee/energy/axe
name = "energy axe"
desc = "An energised battle axe."
+1 -1
View File
@@ -284,7 +284,7 @@
canSmoothWith = list(SMOOTH_GROUP_PLASMA_WALLS)
/obj/structure/falsewall/plasma/attackby(obj/item/W, mob/user, params)
if(is_hot(W) > 300)
if(W.get_heat() > 300)
var/turf/T = locate(user)
message_admins("Plasma falsewall ignited by [key_name_admin(user)] in [ADMIN_VERBOSEJMP(T)]")
log_game("Plasma falsewall ignited by [key_name(user)] in [AREACOORD(T)]")
@@ -177,8 +177,8 @@
sheetType = /obj/item/stack/sheet/mineral/plasma
/obj/structure/mineral_door/transparent/plasma/attackby(obj/item/W, mob/user)
if(is_hot(W))
message_admins("Plasma mineral door ignited by [key_name_admin(user)] in ([x], [y], [z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)", 0, 1)
if(W.get_heat())
message_admins("Plasma mineral door ignited by [key_name_admin(user)] in ([x], [y], [z] - <a href='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)", 0, 1)
log_game("Plasma mineral door ignited by [key_name(user)] in ([x], [y], [z])")
investigate_log("was <font color='red'><b>ignited</b></font> by [key_name(user)]","atmos")
TemperatureAct(100)
+2 -2
View File
@@ -125,11 +125,11 @@
..()
/obj/structure/statue/plasma/attackby(obj/item/W, mob/user, params)
if(is_hot(W) > 300)//If the temperature of the object is over 300, then ignite
if(W.get_heat() > 300)//If the temperature of the object is over 300, then ignite
message_admins("[key_name_admin(user)] ignited a plasma statue at [COORD(loc)]")
log_game("[key_name(user)] ignited plasma a statue at [COORD(loc)]")
investigate_log("[key_name(user)] ignited a plasma statue at [COORD(loc)]", "atmos")
ignite(is_hot(W))
ignite(W.get_heat())
return
return ..()
@@ -36,11 +36,11 @@
PlasmaBurn()
/turf/simulated/floor/mineral/plasma/attackby(obj/item/W, mob/user, params)
if(is_hot(W) > 300)//If the temperature of the object is over 300, then ignite
message_admins("Plasma flooring was ignited by [key_name_admin(user)]([ADMIN_QUE(user,"?")]) ([ADMIN_FLW(user,"FLW")]) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
if(W.get_heat() > 300)//If the temperature of the object is over 300, then ignite
message_admins("Plasma flooring was ignited by [key_name_admin(user)]([ADMIN_QUE(user,"?")]) ([ADMIN_FLW(user,"FLW")]) in ([x],[y],[z] - <a href='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("Plasma flooring was <b>ignited by [key_name(user)] in ([x],[y],[z])")
investigate_log("was <font color='red'><b>ignited</b></font> by [key_name(user)]","atmos")
ignite(is_hot(W))
ignite(W.get_heat())
return
..()
+4 -4
View File
@@ -106,12 +106,12 @@
smoothing_groups = list(SMOOTH_GROUP_SIMULATED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_PLASMA_WALLS)
canSmoothWith = list(SMOOTH_GROUP_PLASMA_WALLS)
/turf/simulated/wall/mineral/plasma/attackby(obj/item/W as obj, mob/user as mob)
if(is_hot(W) > 300)//If the temperature of the object is over 300, then ignite
message_admins("Plasma wall ignited by [key_name_admin(user)] in ([x], [y], [z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
/turf/simulated/wall/mineral/plasma/attackby(obj/item/W, mob/user)
if(W.get_heat() > 300)//If the temperature of the object is over 300, then ignite
message_admins("Plasma wall ignited by [key_name_admin(user)] in ([x], [y], [z] - <a href='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("Plasma wall ignited by [key_name(user)] in ([x], [y], [z])")
investigate_log("was <font color='red'><b>ignited</b></font> by [key_name(user)]","atmos")
ignite(is_hot(W))
ignite(W.get_heat())
return
..()
+3
View File
@@ -59,3 +59,6 @@
if(!istype(loc, /obj/item/assembly_holder))
activate()
add_fingerprint(user)
/obj/item/assembly/igniter/get_heat()
return 2000
@@ -372,7 +372,7 @@
new /obj/effect/hotspot(get_turf(target))
/obj/item/reagent_containers/food/drinks/bottle/molotov/attackby(obj/item/I, mob/user, params)
if(is_hot(I) && !active)
if(I.get_heat() && !active)
active = TRUE
var/turf/bombturf = get_turf(src)
var/area/bombarea = get_area(bombturf)
@@ -98,7 +98,7 @@
/obj/item/reagent_containers/food/drinks/drinkingglass/shotglass/attackby(obj/item/W)
..()
if(is_hot(W))
if(W.get_heat())
fire_act()
/obj/item/reagent_containers/food/drinks/drinkingglass/shotglass/attack_hand(mob/user, pickupfireoverride = TRUE)
+1 -1
View File
@@ -137,7 +137,7 @@
to_chat(user, "<span class='italics'>You add a rod to [src].")
var/image/U = image(icon='icons/obj/hydroponics/equipment.dmi',icon_state="bonfire_rod",pixel_y=16)
underlays += U
if(is_hot(W))
if(W.get_heat())
lighter = user.ckey
user.create_log(MISC_LOG, "lit a bonfire", src)
StartBurning()
@@ -761,6 +761,6 @@
if(resistance_flags & ON_FIRE)
return
if(is_hot(P))
if(P.get_heat())
visible_message("<span class='danger'>[src] bursts into flames!</span>")
fire_act()
+1 -1
View File
@@ -460,7 +460,7 @@
to_chat(user, "<span class='notice'>You stamp the paper with your rubber stamp.</span>")
playsound(user, 'sound/items/handling/standard_stamp.ogg', 50, vary = TRUE)
if(is_hot(P))
if(P.get_heat())
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(10))
user.visible_message("<span class='warning'>[user] accidentally ignites [user.p_themselves()]!</span>", \
"<span class='userdanger'>You miss the paper and accidentally light yourself on fire!</span>")
+2 -2
View File
@@ -53,7 +53,7 @@
to_chat(user, "<span class='notice'>You add [(W.name == "photo") ? "the photo" : W.name] to [(src.name == "paper bundle") ? "the paper bundle" : src.name].</span>")
user.unEquip(W)
W.loc = src
else if(is_hot(W))
else if(W.get_heat())
burnpaper(W, user)
else if(istype(W, /obj/item/paper_bundle))
user.unEquip(W)
@@ -85,7 +85,7 @@
user.visible_message("<span class='[class]'>[user] holds [heating_object] up to [src], it looks like [user.p_theyre()] trying to burn it!</span>", "<span class='[class]'>You hold [heating_object] up to [src], burning it slowly.</span>")
if(!do_after(user, 2 SECONDS, target = src) || !is_hot(heating_object))
if(!do_after(user, 2 SECONDS, target = src) || !heating_object.get_heat())
return
user.visible_message("<span class='[class]'>[user] burns right through [src], turning it to ash. It flutters through the air before settling on the floor in a heap.</span>", \
"<span class='[class]'>You burn right through [src], turning it to ash. It flutters through the air before settling on the floor in a heap.</span>")
+1 -1
View File
@@ -70,7 +70,7 @@
internal_paper.attackby(P, user) //spoofed attack to update internal paper.
update_icon()
else if(is_hot(P))
else if(P.get_heat())
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(10))
user.visible_message("<span class='warning'>[user] accidentally ignites [user.p_themselves()]!</span>", \
"<span class='userdanger'>You miss [src] and accidentally light yourself on fire!</span>")
+1 -1
View File
@@ -214,7 +214,7 @@
/obj/item/ticket_machine_ticket/attackby(obj/item/P, mob/living/carbon/human/user, params) //Stolen from papercode
..()
if(is_hot(P))
if(P.get_heat())
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(10))
user.visible_message("<span class='warning'>[user] accidentally ignites [user.p_themselves()]!</span>", \
"<span class='userdanger'>You miss the paper and accidentally light yourself on fire!</span>")
@@ -190,6 +190,9 @@
/obj/item/gun/energy/plasmacutter/update_overlays()
return list()
/obj/item/gun/energy/plasmacutter/get_heat()
return 3800
/obj/item/gun/energy/plasmacutter/adv
name = "advanced plasma cutter"
icon_state = "adv_plasmacutter"