internal void OnActivateWorkstation(ActivatingWorkstationEventArgs ev) { if (!config.Workstation.canActivateWorkstationGlobal && !config.Workstation.canActivateWorkstation[ev.Player.Role]) { ev.IsAllowed = false; } }
private static bool Prefix(WorkStation __instance, GameObject tabletOwner) { try { if (!__instance.CanPlace(tabletOwner) || __instance._animationCooldown > 0f) { return(false); } Inventory component = tabletOwner.GetComponent <Inventory>(); foreach (Inventory.SyncItemInfo syncItemInfo in component.items) { if (syncItemInfo.id == ItemType.WeaponManagerTablet) { ActivatingWorkstationEventArgs ev = new ActivatingWorkstationEventArgs(Exiled.API.Features.Player.Get(tabletOwner), __instance); Player.OnActivatingWorkstation(ev); if (ev.IsAllowed) { component.items.Remove(syncItemInfo); __instance.NetworkisTabletConnected = true; __instance._animationCooldown = 6.5f; __instance.Network_playerConnected = tabletOwner; } break; } } return(false); } catch (Exception exception) { API.Features.Log.Error($"Exiled.Events.Patches.Events.Player.ActivatingWorkstation: {exception}\n{exception.StackTrace}"); return(true); } }
/// <summary> /// Called before a workstation is activated. /// </summary> /// <param name="ev">The <see cref="ActivatingWorkstationEventArgs"/> instance.</param> public static void OnActivatingWorkstation(ActivatingWorkstationEventArgs ev) => ActivatingWorkstation.InvokeSafely(ev);