Skip to content

Commit

Permalink
Merge pull request #18 from Paxilmaniac/day-night-cycle
Browse files Browse the repository at this point in the history
maybe fixes day and night in the worst possible way
  • Loading branch information
Paxilmaniac authored Jun 28, 2024
2 parents 5a97cd9 + f488b7b commit 2125612
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 13 additions & 5 deletions code/controllers/subsystem/like_night_and_day.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
SUBSYSTEM_DEF(daynight)
name = "Daynight"
flags = SS_NO_FIRE
wait = 10 SECONDS
init_order = INIT_ORDER_NIGHT_AND_DAY
runlevels = RUNLEVELS_DEFAULT

/// This is insanely stupid but it might work? The obj we keep in nullspace that we animate the colors and alpha on to modify our lighting from
var/obj/color_alpha_tracker
/// List of all areas we check for in the day/night cycle
var/list/areas_influenced = list(
/area/vintage/surface_generator,
Expand Down Expand Up @@ -35,9 +36,18 @@ SUBSYSTEM_DEF(daynight)
var/night_duration = 10 MINUTES

/datum/controller/subsystem/daynight/Initialize()
color_alpha_tracker = new
addtimer(CALLBACK(src, PROC_REF(start_afternoon_transition)), daytime_duration)
return SS_INIT_SUCCESS

/datum/controller/subsystem/daynight/fire(resumed)
var/list/areas_to_transition = get_areas_to_edit()
for(var/area/transition_area in areas_to_transition)
if(!transition_area.base_lighting_alpha == color_alpha_tracker.alpha)
transition_area.base_lighting_alpha = color_alpha_tracker.alpha
if(!transition_area.base_lighting_color == color_alpha_tracker.color)
transition_area.base_lighting_color = color_alpha_tracker.color

/// Gets the areas the controller will need to edit
/datum/controller/subsystem/daynight/proc/get_areas_to_edit()
var/list/areas_to_edit = list()
Expand All @@ -46,9 +56,7 @@ SUBSYSTEM_DEF(daynight)
return areas_to_edit

/datum/controller/subsystem/daynight/proc/start_animation(color_to_trans, alpha_to_trans, time_to_trans)
var/list/areas_to_transition = get_areas_to_edit()
for(var/area/transition_area in areas_to_transition)
animate(transition_area, transition_area.base_lighting_color = color_to_trans, transition_area.base_lighting_alpha = alpha_to_trans, time = time_to_trans)
animate(color_alpha_tracker, color = color_to_trans, alpha = alpha_to_trans, time = time_to_trans)

/// Starts the transition to afternoon
/datum/controller/subsystem/daynight/proc/start_afternoon_transition()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/fantasystation_content/crafting/wood.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GLOBAL_LIST_INIT(log_recipes, list(
new/datum/stack_recipe("palisade", /obj/structure/railing/fantasy_palisade, 2, time = 3 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_CHECK_DIRECTION, category = CAT_STRUCTURE),
new/datum/stack_recipe("palisade", /obj/structure/railing/fantasy_palisade, 2, time = 3 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_CHECK_DIRECTION | CRAFT_ON_SOLID_GROUND, category = CAT_STRUCTURE),
))

GLOBAL_LIST_INIT(swamp_log_recipes, list(
new/datum/stack_recipe("palisade", /obj/structure/railing/fantasy_palisade/swamp, 2, time = 3 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_CHECK_DIRECTION, category = CAT_STRUCTURE),
new/datum/stack_recipe("palisade", /obj/structure/railing/fantasy_palisade/swamp, 2, time = 3 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_CHECK_DIRECTION | CRAFT_ON_SOLID_GROUND, category = CAT_STRUCTURE),
))

/obj/item/stack/fantasy_logs
Expand Down

0 comments on commit 2125612

Please sign in to comment.