|
| 1 | +#define IGNITION_TEMP 1922 |
| 2 | + |
1 | 3 | /datum/component/thermite |
2 | 4 | dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS |
3 | 5 | var/amount |
4 | 6 | var/overlay |
| 7 | + var/melting_point = 50 |
5 | 8 |
|
6 | 9 | var/static/list/blacklist = typecacheof(list( |
7 | 10 | /turf/open/lava, |
8 | 11 | /turf/open/space, |
9 | 12 | /turf/open/water, |
10 | | - /turf/open/chasm) |
11 | | - ) |
| 13 | + /turf/open/chasm, |
| 14 | + /turf/open/openspace, |
| 15 | + )) |
12 | 16 |
|
13 | 17 | var/static/list/immunelist = typecacheof(list( |
14 | 18 | /turf/closed/wall/mineral/diamond, |
15 | 19 | /turf/closed/indestructible, |
16 | 20 | /turf/open/indestructible, |
17 | | - /turf/closed/wall/r_wall) |
18 | | - ) |
| 21 | + /turf/closed/wall/r_wall, |
| 22 | + )) |
19 | 23 |
|
20 | 24 | var/static/list/resistlist = typecacheof( |
21 | | - /turf/closed/wall/mineral |
22 | | - ) |
| 25 | + /turf/closed/wall/mineral, |
| 26 | + ) |
23 | 27 |
|
24 | 28 | /datum/component/thermite/Initialize(_amount) |
25 | | - if(!istype(parent, /turf) || blacklist[parent.type]) |
| 29 | + if(!istype(parent, /turf) || is_type_in_typecache(parent, blacklist)) |
26 | 30 | return COMPONENT_INCOMPATIBLE |
27 | 31 | 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 |
29 | 33 | if(resistlist[parent.type]) |
30 | | - _amount*=0.25 |
| 34 | + melting_point = 200 |
31 | 35 |
|
32 | 36 | amount = _amount*10 |
33 | 37 |
|
34 | 38 | var/turf/master = parent |
35 | 39 | overlay = mutable_appearance('icons/effects/effects.dmi', "thermite") |
36 | 40 | master.add_overlay(overlay) |
37 | 41 |
|
| 42 | +/datum/component/thermite/RegisterWithParent() |
38 | 43 | 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)) |
39 | 46 | RegisterSignal(parent, COMSIG_ATOM_ATTACKBY, PROC_REF(attackby_react)) |
40 | 47 | RegisterSignal(parent, COMSIG_ATOM_FIRE_ACT, PROC_REF(flame_react)) |
41 | 48 |
|
| 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 | + |
42 | 61 | /datum/component/thermite/Destroy() |
43 | 62 | var/turf/master = parent |
44 | | - master.cut_overlay(overlay) |
45 | | - return ..() |
| 63 | + . = ..() |
| 64 | + master.update_overlays() |
46 | 65 |
|
47 | 66 | /datum/component/thermite/InheritComponent(datum/component/thermite/newC, i_am_original, _amount) |
48 | 67 | if(!i_am_original) |
|
59 | 78 |
|
60 | 79 | playsound(master, 'sound/items/welder.ogg', 100, 1) |
61 | 80 |
|
62 | | - if(amount >= 50) |
| 81 | + if(amount >= melting_point) |
63 | 82 | var/burning_time = max(100, 100-amount) |
64 | 83 | master = master.Melt() |
65 | 84 | master.burn_tile() |
|
75 | 94 | return TRUE |
76 | 95 |
|
77 | 96 | /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 |
79 | 98 | thermite_melt() |
80 | 99 |
|
81 | 100 | /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) |
83 | 102 | 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