Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 75625d0

Browse files
Fixes thermite (#22777)
* thermite fix * stuff * space
1 parent 6228c39 commit 75625d0

File tree

1 file changed

+45
-14
lines changed

1 file changed

+45
-14
lines changed

code/datums/components/thermite.dm

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,67 @@
1+
#define IGNITION_TEMP 1922
2+
13
/datum/component/thermite
24
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
35
var/amount
46
var/overlay
7+
var/melting_point = 50
58

69
var/static/list/blacklist = typecacheof(list(
710
/turf/open/lava,
811
/turf/open/space,
912
/turf/open/water,
10-
/turf/open/chasm)
11-
)
13+
/turf/open/chasm,
14+
/turf/open/openspace,
15+
))
1216

1317
var/static/list/immunelist = typecacheof(list(
1418
/turf/closed/wall/mineral/diamond,
1519
/turf/closed/indestructible,
1620
/turf/open/indestructible,
17-
/turf/closed/wall/r_wall)
18-
)
21+
/turf/closed/wall/r_wall,
22+
))
1923

2024
var/static/list/resistlist = typecacheof(
21-
/turf/closed/wall/mineral
22-
)
25+
/turf/closed/wall/mineral,
26+
)
2327

2428
/datum/component/thermite/Initialize(_amount)
25-
if(!istype(parent, /turf) || blacklist[parent.type])
29+
if(!istype(parent, /turf) || is_type_in_typecache(parent, blacklist))
2630
return COMPONENT_INCOMPATIBLE
2731
if(immunelist[parent.type])
28-
_amount*=0 //Yeah the overlay can still go on it and be cleaned but you arent burning down a diamond wall
32+
melting_point = INFINITY //Yeah the overlay can still go on it and be cleaned but you arent burning down a diamond wall
2933
if(resistlist[parent.type])
30-
_amount*=0.25
34+
melting_point = 200
3135

3236
amount = _amount*10
3337

3438
var/turf/master = parent
3539
overlay = mutable_appearance('icons/effects/effects.dmi', "thermite")
3640
master.add_overlay(overlay)
3741

42+
/datum/component/thermite/RegisterWithParent()
3843
RegisterSignal(parent, COMSIG_COMPONENT_CLEAN_ACT, PROC_REF(clean_react))
44+
RegisterSignal(parent, COMSIG_ATOM_UPDATE_OVERLAYS, PROC_REF(on_overlay_update))
45+
RegisterSignal(parent, COMSIG_ATOM_TOOL_ACT(TOOL_WELDER), PROC_REF(welder_act))
3946
RegisterSignal(parent, COMSIG_ATOM_ATTACKBY, PROC_REF(attackby_react))
4047
RegisterSignal(parent, COMSIG_ATOM_FIRE_ACT, PROC_REF(flame_react))
4148

49+
/datum/component/thermite/UnregisterFromParent()
50+
UnregisterSignal(parent, list(
51+
COMSIG_ATOM_TOOL_ACT(TOOL_WELDER),
52+
COMSIG_COMPONENT_CLEAN_ACT,
53+
COMSIG_ATOM_UPDATE_OVERLAYS,
54+
COMSIG_ATOM_ATTACKBY,
55+
COMSIG_ATOM_FIRE_ACT,
56+
))
57+
58+
/datum/component/thermite/proc/on_overlay_update(datum/source, list/overlays)
59+
overlays += overlay
60+
4261
/datum/component/thermite/Destroy()
4362
var/turf/master = parent
44-
master.cut_overlay(overlay)
45-
return ..()
63+
. = ..()
64+
master.update_overlays()
4665

4766
/datum/component/thermite/InheritComponent(datum/component/thermite/newC, i_am_original, _amount)
4867
if(!i_am_original)
@@ -59,7 +78,7 @@
5978

6079
playsound(master, 'sound/items/welder.ogg', 100, 1)
6180

62-
if(amount >= 50)
81+
if(amount >= melting_point)
6382
var/burning_time = max(100, 100-amount)
6483
master = master.Melt()
6584
master.burn_tile()
@@ -75,9 +94,21 @@
7594
return TRUE
7695

7796
/datum/component/thermite/proc/flame_react(datum/source, exposed_temperature, exposed_volume)
78-
if(exposed_temperature > 1922) // This is roughly the real life requirement to ignite thermite
97+
if(exposed_temperature > IGNITION_TEMP) // This is roughly the real life requirement to ignite thermite
7998
thermite_melt()
8099

81100
/datum/component/thermite/proc/attackby_react(datum/source, obj/item/thing, mob/user, params)
82-
if(thing.is_hot())
101+
if(thing.is_hot() > IGNITION_TEMP)
83102
thermite_melt(user)
103+
return COMPONENT_BLOCK_TOOL_ATTACK
104+
else if(thing.is_hot())
105+
to_chat(user, span_warning("[thing] isn't hot enough!"))
106+
107+
/datum/component/thermite/proc/welder_act(datum/source, mob/user, obj/item/tool, params)
108+
if(tool.is_hot() > IGNITION_TEMP)
109+
thermite_melt(user)
110+
return COMPONENT_BLOCK_TOOL_ATTACK
111+
else if(tool.is_hot())
112+
to_chat(user, span_warning("[tool] isn't hot enough!"))
113+
114+
#undef IGNITION_TEMP

0 commit comments

Comments
 (0)