Support reading legacy sendprop arrays (#1550)

This rounds out the work started in #1548 to complete support for
reading the older SendPropArray type array netprops, along with bringing
SDKTools' GameRule netprop code in sync with core to add string array
support.

There aren't many SendPropArray type props around but this opens up a
few interesting opportunities for plugin developers, particularly in
L4D2 with manipulation of the EMS HUD.

Tested reading the `m_vCPPositions` array in TF2, and reading/writing
the `m_szScriptedHUDStringSet` EMS HUD netprop in L4D2. Closes #1386.
This commit is contained in:
Asher Baker
2021-08-23 21:21:11 +01:00
committed by GitHub
parent f4ff2ad45a
commit 5ea096e61e
3 changed files with 128 additions and 53 deletions
+4 -2
View File
@@ -169,10 +169,11 @@ native void GameRules_SetPropVector(const char[] prop, const float vec[3], int e
* @param prop Property to use.
* @param buffer Destination string buffer.
* @param maxlen Maximum length of output string buffer.
* @param element Element # (starting from 0) if property is an array.
* @return Number of non-null bytes written.
* @error Prop type is not a string, or lack of mod support.
*/
native int GameRules_GetPropString(const char[] prop, char[] buffer, int maxlen);
native int GameRules_GetPropString(const char[] prop, char[] buffer, int maxlen, int element=0);
/**
* Sets a gamerules property as a string.
@@ -180,10 +181,11 @@ native int GameRules_GetPropString(const char[] prop, char[] buffer, int maxlen)
* @param prop Property to use.
* @param buffer String to set.
* @param changeState This parameter is ignored.
* @param element Element # (starting from 0) if property is an array.
* @return Number of non-null bytes written.
* @error Prop type is not a string, or lack of mod support.
*/
native int GameRules_SetPropString(const char[] prop, const char[] buffer, bool changeState=false);
native int GameRules_SetPropString(const char[] prop, const char[] buffer, bool changeState=false, int element=0);
/**
* Gets the current round state.