entWatch4: Make the internal wait a float instead.

Predator minigun became fucked otherwise.
This commit is contained in:
zaCade 2019-04-15 18:15:00 +02:00
parent 837e40a985
commit 2e13f642c2
2 changed files with 8 additions and 7 deletions

View File

@ -19,7 +19,8 @@ methodmap CItem < Basic
myclass.SetInt("iTimesUsed", 0); myclass.SetInt("iTimesUsed", 0);
myclass.SetInt("iTimeReady", 0); myclass.SetInt("iTimeReady", 0);
myclass.SetInt("iWaitTill", 0);
myclass.SetFloat("flWait", 0.0);
return view_as<CItem>(myclass); return view_as<CItem>(myclass);
} }
@ -111,15 +112,15 @@ methodmap CItem < Basic
} }
} }
property int iWaitTill property float flWait
{ {
public get() public get()
{ {
return this.GetInt("iWaitTill"); return this.GetFloat("flWait");
} }
public set(int value) public set(float value)
{ {
this.SetInt("iWaitTill", value); this.SetFloat("flWait", value);
} }
} }

View File

@ -536,9 +536,9 @@ public Action OnButtonPress(int button, int client)
{ {
if (HasEntProp(button, Prop_Data, "m_flWait")) if (HasEntProp(button, Prop_Data, "m_flWait"))
{ {
if (item.iWaitTill < RoundToCeil(GetEngineTime())) if (item.flWait < GetEngineTime())
{ {
item.iWaitTill = RoundToCeil(GetEngineTime() + GetEntPropFloat(button, Prop_Data, "m_flWait")); item.flWait = GetEngineTime() + GetEntPropFloat(button, Prop_Data, "m_flWait");
} }
else return Plugin_Handled; else return Plugin_Handled;
} }