private bool AddToWhiteList(AutoTurret at, BasePlayer player) { if (at.IsAuthed(player)) { return(false); } var protobufPlayer = new ProtoBuf.PlayerNameID(); protobufPlayer.userid = player.userID; protobufPlayer.username = player.name; at.authorizedPlayers.Add(protobufPlayer); at.SendNetworkUpdate(); at.SetTarget(null); return(true); }
private bool AddToWhiteList(BuildingPrivlidge cb, BasePlayer player) { if (cb.IsAuthed(player)) { return(false); } var protobufPlayer = new ProtoBuf.PlayerNameID(); protobufPlayer.userid = player.userID; protobufPlayer.username = player.name; cb.authorizedPlayers.Add(protobufPlayer); cb.SendNetworkUpdate(); if (cb.CheckEntity(player)) { player.SetInsideBuildingPrivilege(cb, true); } return(true); }
void AddTurret(MiniCopter copter) { AutoTurret aturret = GameManager.server.CreateEntity(autoturretPrefab, copter.transform.position) as AutoTurret; DestroyMeshCollider(aturret); DestroyGroundComp(aturret); aturret.Spawn(); aturret.pickup.enabled = false; aturret.sightRange = config.turretRange; aturret.SetParent(copter); aturret.transform.localPosition = new Vector3(0, 0, 2.47f); aturret.transform.localRotation = Quaternion.Euler(0, 0, 0); ProtoBuf.PlayerNameID pnid = new ProtoBuf.PlayerNameID(); BasePlayer player = BasePlayer.FindByID(copter.OwnerID); if (player != null) { pnid.userid = player.userID; pnid.username = player?.displayName; aturret.authorizedPlayers.Add(pnid); } aturret.SendNetworkUpdate(); AddSwitch(aturret); }
public BasePlayerNameID(ProtoBuf.PlayerNameID proto) { protobuf = proto; }