Skip to content

Gameplay constants at compiletime #935

Open

Description

@GetLocalPlayer

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.

Activity

  1. Frotty commented on Feb 4, 2020

    @Frotty
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions