Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak: get_heat refactor, heating delay #6332

Open
wants to merge 2 commits into
base: master220
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1018,55 +1018,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)
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 == 1)
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(isigniter(W))
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)
Expand Down
11 changes: 7 additions & 4 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@
. |= ATTACK_CHAIN_NO_AFTERATTACK
if(signal_out & COMPONENT_CANCEL_ATTACK_CHAIN)
return .|ATTACK_CHAIN_BLOCKED
var/is_hot = is_hot(src)
if(is_hot && target.reagents && !ismob(target))
to_chat(user, span_notice("You heat [target] with [src]."))
target.reagents.temperature_reagents(is_hot)

var/temperature = get_heat()
if(temperature && target.reagents && !ismob(target) && !istype(target, /obj/item/clothing/mask/cigarette))
var/reagent_temp = target.reagents.chem_temp
var/time = (reagent_temp / 10) / (temperature / 1000)
if(do_after(user, time, target, interaction_key = src, max_interact_count = 1, cancel_message = "You stop heating up [target]."))
to_chat(user, span_notice("You heat [target] with [src]."))
target.reagents.temperature_reagents(temperature)

/**
* Called on an object being hit by an item
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/wizard/artefact.dm
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ GLOBAL_LIST_EMPTY(multiverse)
/obj/item/voodoo/attackby(obj/item/I, mob/user, params)
if(target && COOLDOWN_FINISHED(src, cooldown))
add_fingerprint(user)
if(is_hot(I))
if(I.get_heat())
to_chat(target, span_userdanger("You suddenly feel very hot."))
target.adjust_bodytemperature(50)
else if(is_pointed(I))
Expand Down
5 changes: 2 additions & 3 deletions code/game/machinery/doors/airlock_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,11 @@


/obj/machinery/door/airlock/plasma/attackby(obj/item/I, mob/user, params)
var/heat_temp = is_hot(I)
if(heat_temp > 300)
if(I.get_heat() > 300)
add_fingerprint(user)
add_attack_logs(user, src, "ignited using [I]", ATKLOG_FEW)
investigate_log("was <font color='red'><b>ignited</b></font> by [key_name_log(user)]", INVESTIGATE_ATMOS)
ignite(heat_temp)
ignite(I.get_heat())
return ATTACK_CHAIN_PROCEED_SUCCESS

return ..()
Expand Down
8 changes: 5 additions & 3 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/g
else
return TRUE


/obj/item/blob_act(obj/structure/blob/B)
if(B && B.loc == loc && !QDELETED(src) && !(obj_flags & IGNORE_BLOB_ACT))
obj_destruction(MELEE)
Expand Down Expand Up @@ -540,6 +540,9 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/g
/obj/item/proc/talk_into(mob/M, var/text, var/channel=null)
return

//Generic get_heat proc. Returns 0 or number amount of heat an item gives.
/obj/item/proc/get_heat()
return

/**
* When item is officially left user
Expand Down Expand Up @@ -915,7 +918,6 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/g
if(w_class < WEIGHT_CLASS_BULKY)
itempush = FALSE // too light to push anything

var/is_hot = is_hot(src)
var/volume = get_volume_by_throwforce_and_or_w_class()
var/impact_throwforce = throwforce

Expand All @@ -927,7 +929,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/g
if(. && living.is_in_hands(src))
item_catched = TRUE

if(is_hot && !item_catched)
if(get_heat() && !item_catched)
living.IgniteMob()

if(impact_throwforce > 0 && !item_catched)
Expand Down
4 changes: 3 additions & 1 deletion code/game/objects/items/candle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@
return FALSE
return TRUE

/obj/item/candle/get_heat()
return lit * 1000

/obj/item/candle/attackby(obj/item/I, mob/user, params)
if(is_hot(I) && light(span_notice("[user] lights [src] with [I].")))
if(I.get_heat() && light(span_notice("[user] lights [src] with [I].")))
add_fingerprint(user)
return ATTACK_CHAIN_PROCEED_SUCCESS
return ..()
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/devices/flashlight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@
turn_off()
STOP_PROCESSING(SSobj, src)

/obj/item/flashlight/flare/get_heat()
return on * 1000

/obj/item/flashlight/flare/proc/turn_off()
on = FALSE
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/flag.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/obj/item/flag/attackby(obj/item/I, mob/user, params)
. = ..()
if(ATTACK_CHAIN_CANCEL_CHECK(.) || !is_hot(I) || (resistance_flags & ON_FIRE))
if(ATTACK_CHAIN_CANCEL_CHECK(.) || !I.get_heat() || (resistance_flags & ON_FIRE))
return .
. |= ATTACK_CHAIN_SUCCESS
user.visible_message(
Expand Down Expand Up @@ -285,7 +285,7 @@
add_attack_logs(user, src, "has hidden [I] ready for detonation in", ATKLOG_MOST)
return ATTACK_CHAIN_BLOCKED_ALL

if(is_hot(I) && !(resistance_flags & ON_FIRE) && boobytrap && trapper)
if(I.get_heat() && !(resistance_flags & ON_FIRE) && boobytrap && trapper)
var/turf/bombturf = get_turf(src)
add_game_logs("has lit the [src] trapped with [boobytrap] by [key_name_log(trapper)] at [AREACOORD(bombturf)].", user)
investigate_log("[key_name_log(user)] has lit the [src] trapped with [boobytrap] by [key_name_log(trapper)].", INVESTIGATE_BOMB)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/latexballoon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
blow(I, user)
return ATTACK_CHAIN_PROCEED_SUCCESS

if(state == BALLOON_BLOW && (is_sharp(I) || is_hot(I) || is_pointed(I)))
if(state == BALLOON_BLOW && (is_sharp(I) || I.get_heat() || is_pointed(I)))
burst()
return ATTACK_CHAIN_PROCEED_SUCCESS

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/stacks/sheets/mineral.dm
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( \


/obj/item/stack/sheet/mineral/plasma/attackby(obj/item/I, mob/user, params)
if(is_hot(I))
if(I.get_heat())
log_and_set_aflame(user, I)
return ATTACK_CHAIN_BLOCKED_ALL
return ..()
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/items/tools/welder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
desc = "A standard edition welder provided by Nanotrasen."
icon = 'icons/obj/tools.dmi'
icon_state = "welder"
righthand_file = 'icons/mob/inhands/tools_righthand.dmi'
lefthand_file = 'icons/mob/inhands/tools_lefthand.dmi'
item_state = "welder"
belt_icon = "welding_tool"
flags = CONDUCT
Expand Down Expand Up @@ -210,6 +212,8 @@
if(tool_enabled)
. += "[initial(icon_state)]-on"

/obj/item/weldingtool/get_heat()
return tool_enabled * 2500

/obj/item/weldingtool/largetank
name = "industrial welding tool"
Expand Down
14 changes: 13 additions & 1 deletion code/game/objects/items/weapons/cigs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ 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_PRE_ATTACKBY, PROC_REF(can_light))

/obj/item/clothing/mask/cigarette/Destroy()
QDEL_NULL(reagents)
STOP_PROCESSING(SSobj, src)
UnregisterSignal(src, COMSIG_ITEM_PRE_ATTACKBY)
return ..()


Expand Down Expand Up @@ -102,7 +104,7 @@ LIGHTERS ARE IN LIGHTERS.DM
if(I.tool_enabled)
light(span_notice("[user] непринуждённо зажига[pluralize_ru(user, "ет", "ют")] [declent_ru(ACCUSATIVE)] с помощью [I.declent_ru(GENITIVE)]. Чёрт, как же он[genderize_ru(user.gender, "", "а", "о", "и")] крут[genderize_ru(user.gender, "", "а", "о", "ы")]."))
return ATTACK_CHAIN_PROCEED_SUCCESS

if(istype(I, /obj/item/lighter/zippo))
add_fingerprint(user)
var/obj/item/lighter/zippo/zippo = I
Expand Down Expand Up @@ -216,6 +218,14 @@ LIGHTERS ARE IN LIGHTERS.DM
. = ..()
name = lit ? "lit [initial(name)]" : initial(name)

/obj/item/clothing/mask/cigarette/get_heat()
return lit * 1000

/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/proc/light(flavor_text = null)
if(lit)
Expand Down Expand Up @@ -314,6 +324,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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/grenades/ghettobomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
if(active)
return ATTACK_CHAIN_BLOCKED_ALL

if(is_hot(I))
if(I.get_heat())
trigger(user)
return ATTACK_CHAIN_BLOCKED_ALL

Expand Down
5 changes: 5 additions & 0 deletions code/game/objects/items/weapons/lighters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
else
turn_off_lighter(user)

/obj/item/lighter/get_heat()
return lit * 1500

/obj/item/lighter/proc/turn_on_lighter(mob/living/user)
lit = TRUE
w_class = WEIGHT_CLASS_BULKY
Expand Down Expand Up @@ -359,6 +362,8 @@
var/init_name = initial(name)
desc = lit ? "A [init_name]. This one is lit." : burnt ? "A [init_name]. This one has seen better days." : initial(desc)

/obj/item/match/get_heat()
return lit * 1000

/obj/item/match/proc/matchignite()
if(!lit && !burnt)
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/weapons/melee/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
add_fingerprint(user)
update_icon(UPDATE_ICON_STATE)

/obj/item/melee/energy/get_heat()
return active * 3500

/obj/item/melee/energy/axe
name = "energy axe"
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/false_walls.dm
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@
if(opening)
return ..()

if(is_hot(I) > 300)
if(I.get_heat() > 300)
add_attack_logs(user, src, "Ignited using [I]", ATKLOG_FEW)
investigate_log("was <span class='warning'>ignited</span> by [key_name_log(user)]",INVESTIGATE_ATMOS)
burnbabyburn()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/firepit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
I.fire_act()
return ..()

if(is_hot(I))
if(I.get_heat())
add_fingerprint(user)
if(active)
to_chat(user, span_warning("The [name] is already lit!"))
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/fireplace.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
qdel(I)
return ATTACK_CHAIN_BLOCKED_ALL

if(!is_hot(I))
if(!I.get_heat())
return ..()

add_fingerprint(user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/mineral_doors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@


/obj/structure/mineral_door/transparent/plasma/attackby(obj/item/I, mob/user, params)
var/hot_temp = is_hot(I)
var/hot_temp = I.get_heat()
if(hot_temp)
add_attack_logs(user, src, "Ignited using [I]", ATKLOG_FEW)
investigate_log("was <span class='warning'>ignited</span> by [key_name_log(user)]",INVESTIGATE_ATMOS)
Expand Down
7 changes: 3 additions & 4 deletions code/game/objects/structures/statues.dm
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,10 @@


/obj/structure/statue/plasma/attackby(obj/item/I, mob/user, params)
var/is_hot = is_hot(I)
if(is_hot > 300)//If the temperature of the object is over 300, then ignite
if(I.get_heat() > 300)//If the temperature of the object is over 300, then ignite
add_attack_logs(user, src, "Ignited using [I]", ATKLOG_FEW)
investigate_log("was <span class='warning'>ignited</span> by [key_name_log(user)]",INVESTIGATE_ATMOS)
ignite(is_hot)
ignite(I.get_heat())
return ATTACK_CHAIN_BLOCKED_ALL
return ..()

Expand Down Expand Up @@ -458,7 +457,7 @@


/obj/structure/statue/unknown/attackby(obj/item/I, mob/user, params)
if(is_hot(I) && light(span_notice("[user] lights [src] with [I].")))
if(I.get_heat() && light(span_notice("[user] lights [src] with [I].")))
add_fingerprint(user)
return ATTACK_CHAIN_PROCEED_SUCCESS
return ..()
Expand Down
5 changes: 2 additions & 3 deletions code/game/turfs/simulated/floor/mineral.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@
if(ATTACK_CHAIN_CANCEL_CHECK(.))
return .

var/hot_temp = is_hot(I)
if(hot_temp > 300)//If the temperature of the object is over 300, then ignite
if(I.get_heat() > 300)//If the temperature of the object is over 300, then ignite
add_attack_logs(user, src, "Ignited using [I]", ATKLOG_FEW)
investigate_log("was <span class='warning'>ignited</span> by [key_name_log(user)]",INVESTIGATE_ATMOS)
ignite(hot_temp)
ignite(I.get_heat())
return .|ATTACK_CHAIN_BLOCKED_ALL


Expand Down
5 changes: 2 additions & 3 deletions code/game/turfs/simulated/walls_mineral.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,12 @@
. = ..()
if(ATTACK_CHAIN_CANCEL_CHECK(.))
return .
var/hot_temp = is_hot(I)
if(hot_temp <= 300) //If the temperature of the object is over 300, then ignite
if(I.get_heat() <= 300) //If the temperature of the object is over 300, then ignite
return .
. |= ATTACK_CHAIN_BLOCKED_ALL
add_attack_logs(user, src, "Ignited using [I]", ATKLOG_FEW)
investigate_log("was <span class='warning'>ignited</span> by [key_name_log(user)]",INVESTIGATE_ATMOS)
ignite(hot_temp)
ignite(I.get_heat())



Expand Down
2 changes: 2 additions & 0 deletions code/modules/assembly/igniter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@
activate()
add_fingerprint(user)

/obj/item/assembly/igniter/get_heat()
return 20000
2 changes: 1 addition & 1 deletion code/modules/food_and_drinks/drinks/drinks/bottle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
/obj/item/reagent_containers/food/drinks/bottle/molotov/attackby(obj/item/I, mob/user, params)
. = ..()

if(ATTACK_CHAIN_CANCEL_CHECK(.) || !is_hot(I))
if(ATTACK_CHAIN_CANCEL_CHECK(.) || !I.get_heat())
return .

add_fingerprint(user)
Expand Down
Loading
Loading