mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-19 05:26:28 +00:00
# MAINTAINER - USE THE BUTTON THAT SAYS "MERGE MASTER" THEN SET THE PR TO AUTO-MERGE! IT'S MUCH EASIER FOR ME TO FIX THINGS BEFORE THEY SKEW RATHER THAN AFTER THE FACT. ## About The Pull Request Hey there, This took a while to do, but here's the gist: Python file now regexes every file in `/code` except for those that have some valid reason to be tacking on more global defines. Some of those reasons are simply just that I don't have the time right now (doing what you see in this PR took a few hours) to refactor and parse what should belong and what should be thrown out. For the time being though, this PR will at least _halt_ people making the mistake of not `#undef`ing any files they `#define` "locally", or within the scope of a file. Most people forget to do this and this leads to a lot of mess later on due to how many variables can be unmanaged on the global level. I've made this mistake, you've made this mistake, it's a common thing. Let's automatically check for it so it can be fixed no-stress. Scenarios this PR corrects: * Forgetting to undef a define but undeffing others. * Not undeffing any defines in your file. * Earmarking a define as a "file local" define, but not defining it. * Having a define be a "file local" define, but having it be used elsewhere. * Having a "local" define not even be in the file that it only shows up in. * Having a completely unused define* (* I kept some of these because they seemed important... Others were junked.) ## Why It's Good For The Game If you wanna use it across multiple files, no reason to not make it a global define (maybe there's a few reasons but let's assume that this is the 95% case). Let me know if you don't like how I re-arranged some of the defines and how you'd rather see it be implemented, and I'd be happy to do that. This was mostly just "eh does it need it or not" sorta stuff. I used a pretty cool way to detect if we should use the standardized GitHub "error" output, you can see the results of that here https://github.com/san7890/bruhstation/actions/runs/4549766579/jobs/8022186846#step:7:792 ## Changelog Nothing that really concerns players. (I fixed up all this stuff using vscode, no regexes beyond what you see in the python script. sorry downstreams)
159 lines
4.0 KiB
Plaintext
159 lines
4.0 KiB
Plaintext
#define LOG_BURN_TIMER 150
|
|
#define PAPER_BURN_TIMER 5
|
|
#define MAXIMUM_BURN_TIMER 3000
|
|
|
|
/obj/structure/fireplace
|
|
name = "fireplace"
|
|
desc = "A large stone brick fireplace."
|
|
icon = 'icons/obj/fireplace.dmi'
|
|
icon_state = "fireplace"
|
|
density = FALSE
|
|
anchored = TRUE
|
|
pixel_x = -16
|
|
resistance_flags = FIRE_PROOF
|
|
var/lit = FALSE
|
|
|
|
var/fuel_added = 0
|
|
var/flame_expiry_timer
|
|
|
|
/obj/structure/fireplace/Initialize(mapload)
|
|
. = ..()
|
|
START_PROCESSING(SSobj, src)
|
|
|
|
/obj/structure/fireplace/Destroy()
|
|
STOP_PROCESSING(SSobj, src)
|
|
. = ..()
|
|
|
|
/obj/structure/fireplace/proc/try_light(obj/item/O, mob/user)
|
|
if(lit)
|
|
to_chat(user, span_warning("It's already lit!"))
|
|
return FALSE
|
|
if(!fuel_added)
|
|
to_chat(user, span_warning("[src] needs some fuel to burn!"))
|
|
return FALSE
|
|
var/msg = O.ignition_effect(src, user)
|
|
if(msg)
|
|
visible_message(msg)
|
|
ignite()
|
|
return TRUE
|
|
|
|
/obj/structure/fireplace/attackby(obj/item/T, mob/user)
|
|
if(istype(T, /obj/item/stack/sheet/mineral/wood))
|
|
var/obj/item/stack/sheet/mineral/wood/wood = T
|
|
var/space_remaining = MAXIMUM_BURN_TIMER - burn_time_remaining()
|
|
var/space_for_logs = round(space_remaining / LOG_BURN_TIMER)
|
|
if(space_for_logs < 1)
|
|
to_chat(user, span_warning("You can't fit any more of [T] in [src]!"))
|
|
return
|
|
var/logs_used = min(space_for_logs, wood.amount)
|
|
wood.use(logs_used)
|
|
adjust_fuel_timer(LOG_BURN_TIMER * logs_used)
|
|
user.visible_message("<span class='notice'>[user] tosses some \
|
|
wood into [src].</span>", "<span class='notice'>You add \
|
|
some fuel to [src].</span>")
|
|
else if(istype(T, /obj/item/paper_bin))
|
|
var/obj/item/paper_bin/paper_bin = T
|
|
user.visible_message("<span class='notice'>[user] throws [T] into \
|
|
[src].</span>", "<span class='notice'>You add [T] to [src].\
|
|
</span>")
|
|
adjust_fuel_timer(PAPER_BURN_TIMER * paper_bin.total_paper)
|
|
qdel(paper_bin)
|
|
else if(istype(T, /obj/item/paper))
|
|
user.visible_message("<span class='notice'>[user] throws [T] into \
|
|
[src].</span>", "<span class='notice'>You throw [T] into [src].\
|
|
</span>")
|
|
adjust_fuel_timer(PAPER_BURN_TIMER)
|
|
qdel(T)
|
|
else if(try_light(T,user))
|
|
return
|
|
else
|
|
. = ..()
|
|
|
|
/obj/structure/fireplace/update_overlays()
|
|
. = ..()
|
|
if(!lit)
|
|
return
|
|
|
|
switch(burn_time_remaining())
|
|
if(0 to 500)
|
|
. += "fireplace_fire0"
|
|
if(500 to 1000)
|
|
. += "fireplace_fire1"
|
|
if(1000 to 1500)
|
|
. += "fireplace_fire2"
|
|
if(1500 to 2000)
|
|
. += "fireplace_fire3"
|
|
if(2000 to MAXIMUM_BURN_TIMER)
|
|
. += "fireplace_fire4"
|
|
. += "fireplace_glow"
|
|
|
|
/obj/structure/fireplace/proc/adjust_light()
|
|
if(!lit)
|
|
set_light(0)
|
|
return
|
|
|
|
switch(burn_time_remaining())
|
|
if(0 to 500)
|
|
set_light(1)
|
|
if(500 to 1000)
|
|
set_light(2)
|
|
if(1000 to 1500)
|
|
set_light(3)
|
|
if(1500 to 2000)
|
|
set_light(4)
|
|
if(2000 to MAXIMUM_BURN_TIMER)
|
|
set_light(6)
|
|
|
|
/obj/structure/fireplace/process(delta_time)
|
|
if(!lit)
|
|
return
|
|
if(world.time > flame_expiry_timer)
|
|
put_out()
|
|
return
|
|
|
|
playsound(src, 'sound/effects/comfyfire.ogg',50,FALSE, FALSE, TRUE)
|
|
var/turf/T = get_turf(src)
|
|
T.hotspot_expose(700, 2.5 * delta_time)
|
|
update_appearance()
|
|
adjust_light()
|
|
|
|
/obj/structure/fireplace/extinguish()
|
|
if(lit)
|
|
var/fuel = burn_time_remaining()
|
|
flame_expiry_timer = 0
|
|
put_out()
|
|
adjust_fuel_timer(fuel)
|
|
. = ..()
|
|
|
|
/obj/structure/fireplace/proc/adjust_fuel_timer(amount)
|
|
if(lit)
|
|
flame_expiry_timer += amount
|
|
if(burn_time_remaining() < MAXIMUM_BURN_TIMER)
|
|
flame_expiry_timer = world.time + MAXIMUM_BURN_TIMER
|
|
else
|
|
fuel_added = clamp(fuel_added + amount, 0, MAXIMUM_BURN_TIMER)
|
|
|
|
/obj/structure/fireplace/proc/burn_time_remaining()
|
|
if(lit)
|
|
return max(0, flame_expiry_timer - world.time)
|
|
else
|
|
return max(0, fuel_added)
|
|
|
|
/obj/structure/fireplace/proc/ignite()
|
|
lit = TRUE
|
|
desc = "A large stone brick fireplace, warm and cozy."
|
|
flame_expiry_timer = world.time + fuel_added
|
|
fuel_added = 0
|
|
update_appearance()
|
|
adjust_light()
|
|
|
|
/obj/structure/fireplace/proc/put_out()
|
|
lit = FALSE
|
|
update_appearance()
|
|
adjust_light()
|
|
desc = initial(desc)
|
|
|
|
#undef LOG_BURN_TIMER
|
|
#undef PAPER_BURN_TIMER
|
|
#undef MAXIMUM_BURN_TIMER
|