Stellar Sky

Stellar Sky

916k Downloads

Calendar API is ready

PitchBright opened this issue · 11 comments

commented

The Calendar API that I was talking about with you, TheWeatherPony and CallMeFoxie… has been completed by Foxie, and is ready for use!

https://github.com/CallMeFoxie/Calendar/tree/1.7.10

Let's get this added to StellarSky to keep track of the days and years.

commented

I have no time now, so ill look at it when i have time. It would take a week.

commented

Awesome! People are already trying to make Stellar Sky work with other mods, that require a common calendar… so that's great news that you will add it!

commented

I found it hard to implement compatibility with this API, since It does not allow double for year length.
Do you know the purpose of each methods of ICalendarProvider?

commented

@CallMeFoxie Hello, That's because someone might want float version of getDaysInYear to know its actual length. One might use it for special purpose.
Also, I think there is no reason to make getTicksPerYear as int. One can define 3/4 tick as unit of time, then he cannot use this API.

commented

Hi,
which one exactly do you want to be double? getDaysInYear()?
I would rather make it getDaysInYear(int year) (= year sensitive), as I feel that it would make much more sense. Possibly do the same for the other methods, too?

commented

I see one problem with doubles -- if osmebody does not take in account the fact that it might have decimal point then with a simple multiplication it may drift off with a 0.25 offset (for example).
I would still prefer to make it year-sensitive instead? Or make both versions -- double getDaysInYear(), getTicksInYear() and then make int getDaysInYear(int year) and int getTicksInYear(int year) for actual calculations?
Also what about months? Shouldn't those need double as well then?

commented

Yes months are problem too.
So i want both versions, would it be okay?

commented

Sure, I will look into adding it today :)

commented

It was too hard to implement Calendar API directly, especially on month part.
So I decided to provide own api, and create separate mod about calendar,
which support both Stellar Sky and Calendar API.

commented

Its hard due to calculating month.

commented

I'm sure @CallMeFoxie could help you implement it.