Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gameplay constants at compiletime #935

Open
GetLocalPlayer opened this issue Feb 4, 2020 · 1 comment
Open

Gameplay constants at compiletime #935

GetLocalPlayer opened this issue Feb 4, 2020 · 1 comment

Comments

@GetLocalPlayer
Copy link

GetLocalPlayer commented Feb 4, 2020

I know that the constants are just a text file that can be placed in imports folder but Wurst does not allow us to read data from external files, does it? So we have to copy-paste the data in a wurst package to use it in runtime.
So may be we can have a proper compiletime function? Something like

constant DEF_PER_AGI = compiletime(setGameplayConstant("AgiDefenseBonus", 0.15))
constant DAMAGE_NORMAL = compiletime(setGameplayConstant("DamageBonusNormal", "1.00,1.00,1.00,1.00,1.00,1.00,0.00,1.00")).split(",").map(t -> t.toReal())

Which returns the set value.

@Frotty
Copy link
Member

Frotty commented Feb 4, 2020

In some form I should probably be added, but I'm unsure about the method. I think the setter will cause some confusion with execution order, overriding, default values and such.
I think there are 2 main ideas:

  1. Offer some sandboxed compiletime FileIO which allows u to read files inside the project dir. This would keep the current file in imports.

  2. Add some package to stdlib which contains all values with defaults as configurable constants. Now we would prolly have to ignore/forbid the file in imports, since it will be overriden by wurst.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants