Skip to content

Commit

Permalink
Implement suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
out-of-phaze authored and comma committed Oct 21, 2023
1 parent 6598b40 commit 0905c0e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 19 deletions.
12 changes: 6 additions & 6 deletions code/game/objects/items/weapons/candle/candle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
var/obj/item/flame/candle/other_candle = A
other_candle.light()

/obj/item/flame/candle/proc/light(mob/user)
/obj/item/flame/candle/light(mob/user, no_message)
if(!lit)
lit = TRUE
damtype = BURN
..()
update_force()
user.visible_message(SPAN_NOTICE("\The [user] lights \the [src]."), SPAN_NOTICE("You light \the [src]."))
if(!no_message)
user.visible_message(SPAN_NOTICE("\The [user] lights \the [src]."), SPAN_NOTICE("You light \the [src]."))
set_light(candle_range, candle_power)
START_PROCESSING(SSobj, src)

Expand All @@ -73,7 +73,7 @@

/obj/item/flame/candle/attack_self(mob/user)
if(lit)
lit = FALSE
extinguish(user)
update_icon()
set_light(0)
remove_extension(src, /datum/extension/scent)
Expand All @@ -89,6 +89,6 @@
max_storage_space = 7
slot_flags = SLOT_LOWER_BODY
material = /decl/material/solid/cardboard

/obj/item/storage/candle_box/WillContain()
return list(/obj/item/flame/candle = 7)
27 changes: 22 additions & 5 deletions code/game/objects/items/weapons/flame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
location.hotspot_expose(700, 5) // Potentially set fire to fuel etc.
extinguish(no_message = TRUE)

/obj/item/flame/proc/light(mob/user, no_message)
if(lit)
return
lit = TRUE
damtype = BURN
update_force()
update_icon()

/obj/item/flame/get_heat()
. = max(..(), lit ? lit_heat : 0)

Expand All @@ -48,6 +56,14 @@
randpixel = 10
max_force = 1

/obj/item/flame/match/light(mob/user, no_message)
if(burnt)
return
if(lit)
return
. = ..()
START_PROCESSING(SSobj, src)

/obj/item/flame/match/Process()
if(isliving(loc))
var/mob/living/M = loc
Expand All @@ -70,12 +86,13 @@
extinguish()
return ..()

/obj/item/flame/match/extinguish(var/mob/user, var/no_message)
/obj/item/flame/match/extinguish(var/mob/user, var/no_message, var/burn = TRUE)
. = ..()
name = "burnt match"
desc = "A match. This one has seen better days."
burnt = TRUE
update_icon()
if(burn)
name = "burnt match"
desc = "A match. This one has seen better days."
burnt = TRUE
update_icon()

/obj/item/flame/match/on_update_icon()
. = ..()
Expand Down
6 changes: 4 additions & 2 deletions code/game/objects/items/weapons/lighter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
/obj/item/flame/lighter/populate_reagents()
reagents.add_reagent(/decl/material/liquid/fuel, max_fuel)

/obj/item/flame/lighter/proc/light(mob/user)
/obj/item/flame/lighter/light(mob/user)
if(submerged())
to_chat(user, SPAN_WARNING("You cannot light \the [src] underwater."))
return
lit = TRUE
if(lit)
return
..()
update_icon()
light_effects(user)
set_light(2, l_color = COLOR_PALE_ORANGE)
Expand Down
6 changes: 1 addition & 5 deletions code/game/objects/items/weapons/storage/boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,7 @@

/obj/item/storage/box/matches/attackby(obj/item/flame/match/W, mob/user)
if(istype(W) && !W.lit && !W.burnt)
W.lit = TRUE
W.damtype = BURN
W.update_force()
W.update_icon()
START_PROCESSING(SSobj, W)
W.light()
playsound(src.loc, 'sound/items/match.ogg', 60, 1, -4)
user.visible_message(SPAN_NOTICE("[user] strikes [W] on \the [src]."), SPAN_NOTICE("You strike [W] on \the [src]."))
W.update_icon()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/economy/worth_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
largest_tech_val = next_tech_val
. += largest_tech_val

if(item_flags & ITEM_FLAG_IS_WEAPON && force)
if((item_flags & ITEM_FLAG_IS_WEAPON) && force)
var/weapon_value = ((get_max_weapon_value() * 15) * (1 + max(sharp, edge)))
if(attack_cooldown <= FAST_WEAPON_COOLDOWN)
weapon_value *= 1.5
Expand Down

0 comments on commit 0905c0e

Please sign in to comment.