Commit 6598f7d6 authored by Mikleo's avatar Mikleo

1.25

parent 222f24f4
Pipeline #11303 passed with stages
in 18 seconds
......@@ -10,7 +10,7 @@
#include <SteamWorks>
#define PluginVersion "1.24"
#define PluginVersion "1.25"
float pVersion;
// note linearmap field is unstable
......@@ -382,6 +382,8 @@ public OnMapStart()
PrecacheSound("weapons/mortar/mortar_explode2.wav");
// some maps don't precache this, is essential
PrecacheModel("models/nf/buildings/armory/nf_armory.mdl", true);
latestKnownMapEntity = 0;
Funcs_OnMapStart();
......@@ -4142,10 +4144,10 @@ bool LoadScenario(int client,char[] filename)
LoadCvars(kv);
int hLimit = kv.GetNum("hLimit",BASEHAMMERID -1 );
int hMin = kv.GetNum("hMin",0 );
int hMin = kv.GetNum("hMin",-1 );
int hMax = kv.GetNum("hMax",0 );
if(hMax > 0)
int hMax = kv.GetNum("hMax",-1 );
if(hMax >= 0)
hLimit = hMax;
......@@ -4418,10 +4420,14 @@ LoadEntities(KeyValues kv,float version,int hMin,int hLimit)
entity = RestoreEntity(entity,kv,classInfo,className);
// restore back hammer id
SetEntProp(entity,Prop_Data,"m_iHammerID",hammer_id);
if(entity != -1)
{
// restore back hammer id
SetEntProp(entity,Prop_Data,"m_iHammerID",hammer_id);
includedEntities.Push(entity);
}
}
} while (kv.GotoNextKey(false));
......@@ -4669,6 +4675,13 @@ RestoreEntity(int entity,KeyValues kv,any[] classInfo ,char[] className)
if(isNew )
{
if(!hasPosition)
{
// position isnt optional for entities that are new.
// therefore you can strip fields and if the entity is removed by a mapper it won't be reloaded.
return -1;
}
if(StrEqual(className,"emp_vehicle",true))
{
......@@ -5411,6 +5424,19 @@ LoadMetaData(KeyValues kv)
}
float GetResources(int team)
{
if(team == 2)
{
return GetEntPropFloat(NFTeamEntity,Prop_Send,"resource_balance");
}
else if(team == 3)
{
return GetEntPropFloat(BETeamEntity,Prop_Send,"resource_balance");
}
return 0.0;
}
// hack for now;
SetResources(int team,float amount)
{
......@@ -5426,6 +5452,20 @@ SetResources(int team,float amount)
AcceptEntityInput(paramEntity,"ModifyBEResources",paramEntity,paramEntity);
}
}
float GetTickets(int team)
{
if(team == 2)
{
return GetEntPropFloat(NFTeamEntity,Prop_Send,"tickets_balance");
}
else if(team == 3)
{
return GetEntPropFloat(BETeamEntity,Prop_Send,"tickets_balance");
}
return 0.0;
}
SetTickets(int team,float amount)
{
int paramEntity = EU_ParamEntity();
......
......@@ -1110,6 +1110,14 @@ public int SetVariable(int entity,char[] mArgs,char[] remainder)
// set the local variable here.
SetScriptVariable(variableName,valueToSet);
}
else if(offset == -3)
{
if(type == PropField_Integer)
{
int value = StringToInt(valueToSet);
GlobalVariableInt(variableName[1],value,true);
}
}
else
{
// setting values
......@@ -1806,17 +1814,56 @@ void ReadPackVector(DataPack dataPack,float[3] vector)
vector[2] = ReadPackFloat(dataPack);
}
// TODO
bool GetGlobalVariableInt(char[] variable, int &value)
bool GlobalVariableInt(char[] variable, int &value, bool set = false)
{
if(StrEqual(variable,"g_int_clients_in_server",false))
{
// return the playercount
value = GetClientCount(true);
return true;
}
else if(StrEqual(variable,"g_int_clients_in_teams",false))
{
value = GetTeamClientCount(2) + GetTeamClientCount(3);
return true;
// return the playercount in teams.
}
else if(StrEqual(variable,"g_int_tickets_nf",false))
{
if(set)
SetTickets(2,float(value));
else
value = RoundFloat(GetTickets(2));
return true;
}
else if(StrEqual(variable,"g_int_tickets_be",false))
{
if(set)
SetTickets(3,float(value));
else
value = RoundFloat(GetTickets(3));
return true;
}
else if(StrEqual(variable,"g_int_resources_nf",false))
{
if(set)
SetResources(2,float(value));
else
value = RoundFloat(GetResources(2));
return true;
}
else if(StrEqual(variable,"g_int_resources_be",false))
{
if(set)
SetResources(3,float(value));
else
value = RoundFloat(GetResources(3));
return true;
}
return false;
}
......@@ -1841,9 +1888,20 @@ int FindPropOffset(int entRef,char[] variableName, PropType &propType, PropField
}
else if(StringBegins(variableName, "g_"))
{
if(StringBegins(variableName, "g_int"))
if(StringBegins(variableName, "g_float_"))
{
type = PropField_Float;
return -3;
}
else if(StringBegins(variableName, "g_int_"))
{
type = PropField_Integer;
return -3;
}
else if(StringBegins(variableName, "g_string_"))
{
type = PropField_String;
return -3;
}
}
......@@ -1942,6 +2000,18 @@ ReplaceVariables(int entRef,char[] message,int messageSize)
ReplaceStringEx(message, messageSize,stringToReplace,outputValue,size,-1);
}
if(offset == -3)
{
if(type == PropField_Integer)
{
int value;
if(GlobalVariableInt(variable,value))
{
IntToString(value,outputValue,sizeof(outputValue));
ReplaceStringEx(message, messageSize,stringToReplace,outputValue,size,-1);
}
}
}
else if(offset != -1)
{
......
......@@ -4,7 +4,7 @@
{
"Version"
{
"Latest" "1.24"
"Latest" "1.25"
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment