RynthCore as of 2026-11-08 (internal 9297e93): release 2026.11.8.1
This commit is contained in:
parent
418d80bafb
commit
c68204f160
99 changed files with 5032 additions and 185 deletions
|
|
@ -1848,6 +1848,35 @@ public readonly unsafe struct RynthCoreHost
|
|||
return r == 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// v93: <see cref="TryGetMonsterHealth"/> (the monster plates' last server health reading per object).
|
||||
/// </summary>
|
||||
public bool HasMonsterHealth => _api.Version >= 93 && _api.GetMonsterHealthFn != IntPtr.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// v93: the last health ratio (0..1) the server sent for <paramref name="id"/>, as the engine's monster
|
||||
/// plates keep it, and how many ms ago (<paramref name="ageMs"/>). The plates ask the server for the
|
||||
/// monsters around the player round-robin (about one a second; ones in a fight every 2 s, quiet ones
|
||||
/// every 12 s), so this covers monsters whose health the server streams to nobody else here. Those
|
||||
/// probe replies never arrive as UpdateHealth events (a plugin must not count someone else's hit as
|
||||
/// its own): use this for ranking, not for kill or damage tracking. Never the plates' estimates from
|
||||
/// the player's hits. False when the server never sent this object's health, or on an older engine.
|
||||
/// Read-only, any thread.
|
||||
/// </summary>
|
||||
public bool TryGetMonsterHealth(uint id, out float ratio, out uint ageMs)
|
||||
{
|
||||
ratio = -1f;
|
||||
ageMs = uint.MaxValue;
|
||||
if (!HasMonsterHealth || id == 0) return false;
|
||||
float r = -1f;
|
||||
uint age = uint.MaxValue;
|
||||
int ok = ((delegate* unmanaged[Cdecl]<uint, float*, uint*, int>)_api.GetMonsterHealthFn)(id, &r, &age);
|
||||
if (ok != 1 || float.IsNaN(r) || r < 0f) return false;
|
||||
ratio = Math.Min(r, 1f);
|
||||
ageMs = age;
|
||||
return true;
|
||||
}
|
||||
|
||||
private int CallSetActionKey(string action, string key, int op, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
|
|
|||
Loading…
Reference in a new issue