private void OnStartup(EntityUid uid, SharedCombatModeComponent component, ComponentStartup args) { if (component.CombatToggleAction == null && _protoMan.TryIndex(component.CombatToggleActionId, out InstantActionPrototype? toggleProto)) { component.CombatToggleAction = new(toggleProto); } if (component.CombatToggleAction != null) { _actionsSystem.AddAction(uid, component.CombatToggleAction, null); } if (component.DisarmAction == null && component.CanDisarm && _protoMan.TryIndex(component.DisarmActionId, out EntityTargetActionPrototype? disarmProto)) { component.DisarmAction = new(disarmProto); } if (component.DisarmAction != null && component.CanDisarm) { _actionsSystem.AddAction(uid, component.DisarmAction, null); } }
private void OnActionPerform(EntityUid uid, SharedCombatModeComponent component, ToggleCombatActionEvent args) { if (args.Handled) { return; } component.IsInCombatMode = !component.IsInCombatMode; args.Handled = true; }
private void OnShutdown(EntityUid uid, SharedCombatModeComponent component, ComponentShutdown args) { if (component.CombatToggleAction != null) { _actionsSystem.RemoveAction(uid, component.CombatToggleAction); } if (component.DisarmAction != null) { _actionsSystem.RemoveAction(uid, component.DisarmAction); } }
private void OnStartup(EntityUid uid, SharedCombatModeComponent component, ComponentStartup args) { _actionsSystem.AddAction(uid, component.CombatToggleAction, null); _actionsSystem.AddAction(uid, component.DisarmAction, null); }