Skip to content

Commit 8133983

Browse files
authored
feat: Adds OnThirstChanged (#2313)
1 parent e8c129b commit 8133983

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

Projects/Server/Mobiles/Mobile.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ public static void Configure()
293293

294294
private int m_HueMod = -1;
295295
private int m_Hunger;
296+
private int _thirst;
296297

297298
private bool m_InDeltaQueue;
298299
private int m_Kills;
@@ -513,7 +514,20 @@ public int Hunger
513514
}
514515

515516
[CommandProperty(AccessLevel.GameMaster)]
516-
public int Thirst { get; set; }
517+
public int Thirst
518+
{
519+
get => _thirst;
520+
set
521+
{
522+
var oldValue = _thirst;
523+
524+
if (oldValue != value)
525+
{
526+
_thirst = value;
527+
OnThirstChanged(oldValue);
528+
}
529+
}
530+
}
517531

518532
[CommandProperty(AccessLevel.GameMaster)]
519533
public int BAC { get; set; }
@@ -3725,6 +3739,14 @@ public virtual void OnHungerChanged(int oldValue)
37253739
{
37263740
}
37273741

3742+
/// <summary>
3743+
/// Overridable. Virtual event invoked after the <see cref="Thirst" /> property has changed.
3744+
/// <seealso cref="Thirst" />
3745+
/// </summary>
3746+
public virtual void OnThirstChanged(int oldValue)
3747+
{
3748+
}
3749+
37283750
public virtual void AggressiveAction(Mobile aggressor) => AggressiveAction(aggressor, false);
37293751

37303752
public virtual void AggressiveAction(Mobile aggressor, bool criminal)

0 commit comments

Comments
 (0)