1class PluginUniversalTemperatureSourceClient
extends PluginBase
54 float fullRange = utsd.GetValue(1).ToFloat();
55 float maxRange = utsd.GetValue(2).ToFloat();
56 float temp = utsd.GetValue(3).ToFloat();
57 vector sphPos = utsd.GetValue(0).ToVector();
68 fullRangeColor = 0x1fefefef;
69 maxRangeColor = 0x1fefefef;
81 DbgUI.
Begin(
"Universal Temp Sources", 10, 300);
110 float min = MiscGameplayFunctions.GetMinValue(utsTemperatures);
111 float max = MiscGameplayFunctions.GetMaxValue(utsTemperatures);
113 if (max > 0 && min < 0)
127 distance =
Math.
Max(distance, 0.1);
128 float temperature = 0;
131 if (distance > utsd.GetValue(1).ToFloat())
133 float distFactor =
Math.
InverseLerp(utsd.GetValue(2).ToFloat(), utsd.GetValue(1).ToFloat(), distance);
134 distFactor =
Math.
Max(distFactor, 0.0);
135 temperature = utsd.GetValue(3).ToFloat() * distFactor;
139 temperature = utsd.GetValue(3).ToFloat();
162 vector pos = utsd.GetValue(0).ToVector();
165 m_RootWidget[i].SetPos(screen_pos_stats[0], screen_pos_stats[1]);
167 if (screen_pos_stats[2] > 0 && screen_pos_stats[0] > 0 && screen_pos_stats[1] > 0)
193 int numPairs = utsd.PairsCount();
194 for (
int i = 0; i < numPairs; ++i)
219 rpc.
Send(player,
ERPCs.DEV_REQUEST_UTS_DEBUG,
true, player.GetIdentity());
228 PrintString(
"-------------------------------------");
230 PrintString(
"-------------------------------------");
proto native vector GetScreenPos(vector world_pos)
Transforms position in world to position in screen in pixels as x, y component of vector,...
proto native WorkspaceWidget GetWorkspace()
static Shape DrawCylinder(vector pos, float radius, float height=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
static Shape DrawArrow(vector from, vector to, float size=0.5, int color=0xFFFFFFFF, int flags=0)
void UpdateStatWidget(int rowIndex, UTemperatureSourceDebug utsd)
void RequestUniversalTemperatureSources(PlayerBase player, int enable)
void PluginUniversalTemperatureSourceClient()
void ProcessUniversalTemperatureSources()
void PluginUniversalTemperatureSourceServer()
TextWidget m_HeaderWidget[MAX_SIMULTANEOUS_UTS]
ref array< ref UTemperatureSourceDebug > m_UTemperatureSourceDebugs
TextListboxWidget m_StatListWidgets[MAX_SIMULTANEOUS_UTS]
const int MAX_SIMULTANEOUS_UTS
void OnRPC(ParamsReadContext ctx)
float CalcTemperatureFromTemperatureSource(notnull UTemperatureSourceDebug utsd)
float m_UTSAverageTemperature
override void OnUpdate(float delta_time)
void EnableWidgets(bool enable)
ref Widget m_RootWidget[MAX_SIMULTANEOUS_UTS]
proto native void Send(Object target, int rpc_type, bool guaranteed, PlayerIdentity recipient=NULL)
Initiate remote procedure call. When called on client, RPC is evaluated on server; When called on ser...
proto bool Write(void value_out)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
Serializer ParamsReadContext
proto native CGame GetGame()
static proto native void End()
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto native void Text(string label)
void PrintString(string s)
Helper for printing out string expression. Example: PrintString("Hello " + var);.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float SqrFloat(float f)
Returns squared value.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...