Skip to content

Beacon changes (funcommands)#1187

Merged
asherkin merged 15 commits intoalliedmodders:masterfrom
Mart-User:master
Feb 23, 2020
Merged

Beacon changes (funcommands)#1187
asherkin merged 15 commits intoalliedmodders:masterfrom
Mart-User:master

Conversation

@Mart-User
Copy link
Contributor

@Mart-User Mart-User commented Feb 22, 2020

Some changes to the beacon fun function.

Changes to funcommands.sp / beacon.sp / funcommands.games.txt:

  • Created beacon color config through reading gamedata file (funcommands.games.txt).
  • Added game specific color settings for "Team 2" and "Team 3" on L4D/L4D2. (They should be inverse as e.g: CSGO)
  • Added different color for Team 4 (hidden team on L4D2).
  • Added color config for unknown teams (teams that are not in: 1,2,3,4).
  • Loading external beacon color (first beacon) from gamedata.
  • Updated "if else" to "switch case" statement.
  • Added "teamBeaconColor" var to set the beacon color based on the client's team, instead of calling TE_SetupBeamRingPoint on each point.
  • Moved TE_SetupBeamRingPoint calls more near each other.

Added game color config & specific settings for L4D/L4D2

Created the following keys:

"Team1Color"	"75,255,75,255"
"Team2Color"	"255,75,75,255"
"Team3Color"	"75,75,255,255"
"Team4Color"	"255,128,0,255"
"TeamUnknownColor"	"255,255,255,255"

Added a specific setting for L4D/L4D2 game:

"Team2Color"	"75,75,255,255"
"Team3Color"	"255,75,75,255"
Added method "GetColor" to convert the string into a valid int[4] RGBA format.

Created 5 new vars:

int g_Team1Color[4]
int g_Team2Color[4]
int g_Team3Color[4]
int g_Team4Color[4]
int g_TeamUnknownColor[4]

Loading 5 new configs from funcommands.games.txt (gamedata file):

Team1Color -> g_Team1Color
Team2Color -> g_Team2Color
Team3Color -> g_Team3Color
Team4Color -> g_Team4Color
TeamUnknownColor -> g_TeamUnknownColor
-Added "teamColor" var to set the beacon color based on the client's team, instead of calling TE_SetupBeamRingPoint on each team check.
-Moved TE_SetupBeamRingPoint calls more near each other.
-Converted "if else" to "switch case" statement.
-Removed "team" var.
-Added different beacon color to Team 4 (hidden team on L4D2), may also apply to other games.
Added External Beacon key:

- ExternalBeaconColor
Added External Beacon

- ExternalBeaconColor key -> g_ExternalBeaconColor var
External beacon color reading from g_ExternalBeaconColor var
Colors based on default funcommands.sp color vars
Fixed beacon key names
Fixed beacon key names
Renamed teamColor var to teamBeaconColor
Copy link
Member

@asherkin asherkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bringing this back - the gamedata stuff is a solid improvement here and I think a lot of L4D(2) servers are going to like it.

I've left a couple of small inlines I'd like to see addressed before merging, but otherwise this looks mostly like what was ready-to-go before.

Renamed GetColor Method to ParseMethod
Added a new line at the end of funcommands.sp file
@Mart-User
Copy link
Contributor Author

Some var colors aren't being used now, like "greencolor" and "redcolor" so the build will fail.
I don't know-how is safe to remove this vars, any suggestion?

@asherkin
Copy link
Member

Some var colors aren't being used now, like "greencolor" and "redcolor" so the build will fail.
I don't know-how is safe to remove this vars, any suggestion?

I'd go with just removing the unused ones.

Removed unused vars:

- redColor
- greenColor
@asherkin
Copy link
Member

Looks like the changes from the previous commit got reverted.

Changed method name "GetColor" to "ParseColor"
Added new line ending to the file
@Mart-User
Copy link
Contributor Author

Yeah thanks! Repaired.

Removed TrimString function from the code.
Used before when the separator was a space, but changed it to a comma to be safer.
@asherkin asherkin merged commit cd37354 into alliedmodders:master Feb 23, 2020
@asherkin
Copy link
Member

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants