Everyfing is cleaned, but, unifying code is a good approach for whoever want to use the game for it's own game.
This is my idea.
The tone manager and the clock code are separated objects as for now, their similitude is that they are linked through the game object. Both have time related code, tone manager have time:set() and time_flow:set(), clock script have things to manage these.
My idea is to create a time_manager script which will englobe all of time related functions and that will connect these 2 scripts together, easier for the documentation and cleaner.
Because time function was spreaded around the tone manager and the clock script, which might not be convenient
[x] game.time:get()
-> Returns the hour, minute, day and time of day
[x] game.time:set(hour, minute, day)
-> Set the new time, the time of day is automatically selected
[x] game.time:fast_forward()
-> set the time flow to 10 until the time is set to 6AM or 6PM
[x] game.time:set_flow(flow)
-> set a new time flow, the default is 1000 (1sec = 1 min)
[x] game.time:set_tone(r, g, b, a)
-> set a tone to the current map, the duration is immediate
[x] game.time:set_npc_route_flow_modifer(modifer)
-> modify the NPC speed, if they are time dependant, the default value is 1
[x] game.time:get_npc_route_flow_modifer()
-> return the above result
[x] game.time:freeze()
-> Stops the time
[x] game.time:resume()
-> Reset the time
These bellow will be unused but might serve for others
[x] game.time:reset()
-> Reset the time to 6:AM at day 0
[x] game.time:slow()
-> Slow down the time (playing the song of inverted time) time_flow /1.5
[x] game.time:set_with_bell_sound(bool)
-> Play Majora's Mask bell toll at 5:30 AM/PM
Everyfing is cleaned, but, unifying code is a good approach for whoever want to use the game for it's own game.
This is my idea.
The tone manager and the clock code are separated objects as for now, their similitude is that they are linked through the game object. Both have time related code, tone manager have time:set() and time_flow:set(), clock script have things to manage these.
My idea is to create a time_manager script which will englobe all of time related functions and that will connect these 2 scripts together, easier for the documentation and cleaner.
Because time function was spreaded around the tone manager and the clock script, which might not be convenient
[x] game.time:get() -> Returns the hour, minute, day and time of day
[x] game.time:set(hour, minute, day) -> Set the new time, the time of day is automatically selected
[x] game.time:fast_forward() -> set the time flow to 10 until the time is set to 6AM or 6PM
[x] game.time:set_flow(flow) -> set a new time flow, the default is 1000 (1sec = 1 min)
[x] game.time:set_tone(r, g, b, a) -> set a tone to the current map, the duration is immediate
[x] game.time:set_npc_route_flow_modifer(modifer) -> modify the NPC speed, if they are time dependant, the default value is 1
[x] game.time:get_npc_route_flow_modifer() -> return the above result
[x] game.time:freeze() -> Stops the time
[x] game.time:resume() -> Reset the time
These bellow will be unused but might serve for others
[x] game.time:reset() -> Reset the time to 6:AM at day 0
[x] game.time:slow() -> Slow down the time (playing the song of inverted time) time_flow /1.5
[x] game.time:set_with_bell_sound(bool) -> Play Majora's Mask bell toll at 5:30 AM/PM
[x] game.time:get_with_bell_sound()