object OnSamSiteTarget(SamSite samsite, MiniCopter target) { BasePlayer player = target.GetDriver(); BuildingPrivlidge priviledge = samsite.GetBuildingPrivilege(); if (player != null && permission.UserHasPermission(player.UserIDString, turretsIgnore) || (samsite.ShortPrefabName == "sam_site_turret_deployed" && _config.samSitesAffected || samsite.ShortPrefabName == "sam_static" && _config.staticSamSitesAffected) && (priviledge == null || priviledge != null && ((priviledge.IsAuthed(player) || (!priviledge.IsAuthed(player.userID) && !player.IsBuildingBlocked()))))) { return(false); } return(null); }
public void ToggleSamsite(SamSite sam, BasePlayer player = null) { if (player != null) { if (sam.GetBuildingPrivilege() != player.GetBuildingPrivilege()) { player.ChatMessage(Instance.Lang("NoPermThisTurret", player.UserIDString)); return; } } if (sam.IsPowered() || onlineSams.Contains(sam)) { PowerSamsiteOff(sam); } else { PowerSamsiteOn(sam); } sam.SendNetworkUpdate(); }
public void ToggleSamsite(SamSite samSite, BasePlayer player = null) { if (samSite == null) { return; } if (player != null && samSite.GetBuildingPrivilege()?.IsAuthed(player) == false) { player.ChatMessage(_instance.Lang("NoPermThisTurret", player.UserIDString)); return; } if (samSite.IsPowered()) { PowerSamsiteOff(samSite); } else { PowerSamsiteOn(samSite); } samSite.SendNetworkUpdate(); }