Skip to content

Angelscript GetKeyValue returns incorrect values from color KVs #2180

@vrad-exe

Description

@vrad-exe

Describe the bug

If CBaseEntity::GetKeyValue() in Angelscript is used to retrieve the value of a color KV (tested in my case with env_portal_laser's beamcolor), the returned string will contain a single 32-bit integer containing all four RGBA color channels, followed by three more random 32 bit integers which when converted to hex seem to just be various combinations of 00 and DE.

Examples from a number of lasers:

Laser found: laser_green1
Parsed color: -10158236 0 -570425344 -555819298
Laser found: laser_white
Parsed color: -1 0 -570425344 -555819298
Laser found: laser_green3
Parsed color: -16752319 0 -570425344 -555819298
Laser found: laser_green2
Parsed color: -16711936 0 -570425344 -555819298
Laser found: laser_blue
Parsed color: -3510240 0 -570425344 -555819298
Laser found: laser_yellow
Parsed color: -10758913 0 -570425344 -555819298
Laser found: laser_pink
Parsed color: -7193388 0 -570425344 -555819298
Laser found: laser_red2
Parsed color: -13500161 0 -570425344 -555819298
Laser found: laser_red3
Parsed color: -10223361 0 -570425344 -555819298
Laser found: test_lasers_black
Parsed color: 0 0 -570425344 -555819298
Laser found: test_lasers_black
Parsed color: 0 0 -570425344 -555819298
Laser found: test_lasers_white
Parsed color: -1 0 -570425344 -555819298
Laser found: test_lasers_white
Parsed color: -1 0 -570425344 -555819298
Laser found: laser_control
Laser found: laser_red1
Parsed color: -16776961 0 -570425344 -555819298
Laser found: laser_nocolor
Parsed color: -16776961 0 -570425344 -555819298

Expected behavior is that it should either return the individual color channel bytes separated by spaces, or return a single 32 bit integer as a string.

Issue Map

Any

To Reproduce

  1. Write an angelscript which calls GetKeyValue() with the name of a color KV and prints the result
  2. Look at the result

Operating System

Tested on Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Compat: Portal 2Breaks Portal 2 compatabilityPriority 3: MediumMedium priority stuffSize 4: Smallaffects a few things--might be trival to completeType: BugSomething isn't workingWhat: ScriptingIssues relating to VScript or AngelScript.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions