Update dice state handling (#23643)
* Auto generate dice component state handling, and update data field annotations * Missed one.
This commit is contained in:
@@ -14,23 +14,14 @@ public abstract class SharedDiceSystem : EntitySystem
|
||||
SubscribeLocalEvent<DiceComponent, UseInHandEvent>(OnUseInHand);
|
||||
SubscribeLocalEvent<DiceComponent, LandEvent>(OnLand);
|
||||
SubscribeLocalEvent<DiceComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<DiceComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<DiceComponent, ComponentHandleState>(OnHandleState);
|
||||
SubscribeLocalEvent<DiceComponent, AfterAutoHandleStateEvent>(OnDiceAfterHandleState);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, DiceComponent component, ref ComponentHandleState args)
|
||||
private void OnDiceAfterHandleState(EntityUid uid, DiceComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (args.Current is DiceComponent.DiceState state)
|
||||
component.CurrentValue = state.CurrentValue;
|
||||
|
||||
UpdateVisuals(uid, component);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, DiceComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new DiceComponent.DiceState(component.CurrentValue);
|
||||
}
|
||||
|
||||
private void OnUseInHand(EntityUid uid, DiceComponent component, UseInHandEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
|
||||
Reference in New Issue
Block a user