beyond-all-reason / beyond-all-reason/RecoilEngine

Let customparams be (raw) numbers and bools

Open
#2,045 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 2h
Merged PRs (30d)
40

Description

Bill of materials to be done before starting this ticket:
* awareness of #1057 for the larger picture

----

If your input file looks like
```lua
-- units/tank.lua
customparams = {
count = math.pi,
is_foo = true,
is_baz = false,
},
```
Then when retrieving it in a wupget via `UnitDefs[x].customParams.bla` you get
```lua
count = "3.1415" -- string
is_foo = "1" -- string
is_baz = "0" -- string and evaluates to true in Lua!!!
```

The request is to make them conform to their original type. Keep in mind this only applies to basic types (number, boolean, and string) so stuff like functions or userdata should be dropped (I am unsure what happens to them right now, but given it always converts to string at worst you get some inert garbage - this would become dangerous if you kept the type intact). Table support is desirable but potentially difficult so is not in the scope of the ticket (see #1057) Rules params do this correctly (internally via `std::variant`) so perhaps see if that can be reused.

Contributor guide

Open the contributing guide

Research direction

Start with issue #1057 and the Rules params implementation using std::variant; trace how UnitDefs[x].customParams is populated from units/tank.lua. Confirm that numbers, booleans, and strings retain their original types, while functions and userdata are dropped and tables remain out of scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, lua
Domain
game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.