예제 #1
0
        IEnumerator DelayAnimationAndDisablePiloting(Vehicle vehicle, VehicleDockingBay vehicleDockingBay, NitroxId vehicleId, ushort playerId)
        {
            yield return(new WaitForSeconds(1.0f));

            // DockVehicle sets the rigid body kinematic of the vehicle to true, we don't want that behaviour
            // Therefore disable kinematic (again) to remove the bouncing behavior
            vehicleDockingBay.DockVehicle(vehicle);
            vehicle.useRigidbody.isKinematic = false;
            yield return(new WaitForSeconds(2.0f));

            vehicles.SetOnPilotMode(vehicleId, playerId, false);
            if (!vehicle.docked)
            {
                Log.Error($"Vehicle {vehicleId} not docked after docking process");
            }
        }
예제 #2
0
 public bool HasAnyLockType(NitroxId id)
 {
     return(PlayerHasMinLockType(id, SimulationLockType.TRANSIENT));
 }
예제 #3
0
        public void RequestSimulationLock(NitroxId id, SimulationLockType lockType)
        {
            SimulationOwnershipRequest ownershipRequest = new SimulationOwnershipRequest(muliplayerSession.Reservation.PlayerId, id, lockType);

            packetSender.Send(ownershipRequest);
        }
예제 #4
0
 private void SetPlayerGameObjectId(NitroxId id)
 {
     NitroxIdentifier.SetNewId(Player.mainObject, id);
     Log.Info("Received initial sync Player GameObject Id: " + id);
 }
예제 #5
0
 public void RemoveVehicle(NitroxId id)
 {
     RemoveItemsFromVehicle(id);
     vehiclesById.Remove(id);
 }
예제 #6
0
 public SeamothModel(NitroxModel.DataStructures.TechType techType, NitroxId id, Vector3 position, Quaternion rotation, List <InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional <NitroxId> dockingBayId, string name, Vector3[] hsb, float health) : base(techType, id, position, rotation, interactiveChildIdentifiers, dockingBayId, name, hsb, health)
 {
     LightOn = true;
 }
예제 #7
0
 public PingRenamed(NitroxId id, string name, byte[] beaconGameObjectSerialized)
 {
     Id   = id;
     Name = name;
     BeaconGameObjectSerialized = beaconGameObjectSerialized;
 }
예제 #8
0
 public SimulationOwnershipResponse(NitroxId id, bool lockAquired, SimulationLockType lockType)
 {
     Id          = id;
     LockAquired = lockAquired;
     LockType    = lockType;
 }
예제 #9
0
 public CyclopsChangeSilentRunning(NitroxId id, bool isOn)
 {
     Id   = id;
     IsOn = isOn;
 }
예제 #10
0
 public FabricatorItemPickup(NitroxId fabricatorId, NitroxTechType techType)
 {
     FabricatorId = fabricatorId;
     TechType     = techType;
 }
예제 #11
0
 public VehicleDestroyed(NitroxId id, string playerName, bool getPilotingMode)
 {
     Id              = id;
     PlayerName      = playerName;
     GetPilotingMode = getPilotingMode;
 }
예제 #12
0
 public EquippedItemData(NitroxId containerId, NitroxId itemId, byte[] serializedData, string slot, TechType techType) : base(containerId, itemId, serializedData)
 {
     Slot     = slot;
     TechType = techType;
 }
예제 #13
0
 public CyclopsFireSuppression(NitroxId id)
 {
     Id = id;
 }
예제 #14
0
        public static void Prefix(BaseDeconstructable __instance)
        {
            NitroxId id = NitroxEntity.GetId(__instance.gameObject);

            TransientLocalObjectManager.Add(TransientObjectType.LATEST_DECONSTRUCTED_BASE_PIECE_GUID, id);
        }
예제 #15
0
 public FabricatorBeginCrafting(NitroxId fabricatorId, TechType techType, float duration)
 {
     FabricatorId = fabricatorId;
     TechType     = techType;
     Duration     = duration;
 }
예제 #16
0
        public override void Process(PlayerJoiningMultiplayerSession packet, NitroxConnection connection)
        {
            Player player = playerManager.PlayerConnected(connection, packet.ReservationKey, out bool wasBrandNewPlayer);

            NitroxId assignedEscapePodId = world.EscapePodManager.AssignPlayerToEscapePod(player.Id, out Optional <EscapePodModel> newlyCreatedEscapePod);

            if (newlyCreatedEscapePod.HasValue)
            {
                AddEscapePod addEscapePod = new(newlyCreatedEscapePod.Value);
                playerManager.SendPacketToOtherPlayers(addEscapePod, player);
            }

            List <EquippedItemData> equippedItems  = player.GetEquipment();
            List <NitroxTechType>   techTypes      = equippedItems.Select(equippedItem => equippedItem.TechType).ToList();
            List <ItemData>         inventoryItems = GetInventoryItems(player.GameObjectId);

            PlayerJoinedMultiplayerSession playerJoinedPacket = new(player.PlayerContext, player.SubRootId, techTypes, inventoryItems);

            playerManager.SendPacketToOtherPlayers(playerJoinedPacket, player);

            // Make players on localhost admin by default.
            if (IPAddress.IsLoopback(connection.Endpoint.Address))
            {
                player.Permissions = Perms.ADMIN;
            }

            List <NitroxId>            simulations = world.EntitySimulation.AssignGlobalRootEntities(player).ToList();
            IEnumerable <VehicleModel> vehicles    = world.VehicleManager.GetVehicles();

            foreach (VehicleModel vehicle in vehicles)
            {
                if (world.SimulationOwnershipData.TryToAcquire(vehicle.Id, player, SimulationLockType.TRANSIENT))
                {
                    simulations.Add(vehicle.Id);
                }
            }

            InitialPlayerSync initialPlayerSync = new(player.GameObjectId,
                                                      wasBrandNewPlayer,
                                                      world.EscapePodManager.GetEscapePods(),
                                                      assignedEscapePodId,
                                                      equippedItems,
                                                      GetAllModules(world.InventoryManager.GetAllModules(), player.GetModules()),
                                                      world.BaseManager.GetBasePiecesForNewlyConnectedPlayer(),
                                                      vehicles,
                                                      world.InventoryManager.GetAllInventoryItems(),
                                                      world.InventoryManager.GetAllStorageSlotItems(),
                                                      player.UsedItems,
                                                      player.QuickSlotsBinding,
                                                      world.GameData.PDAState.GetInitialPDAData(),
                                                      world.GameData.StoryGoals.GetInitialStoryGoalData(scheduleKeeper),
                                                      new HashSet <string>(player.CompletedGoals),
                                                      player.Position,
                                                      player.SubRootId,
                                                      player.Stats,
                                                      GetRemotePlayerData(player),
                                                      world.EntityManager.GetGlobalRootEntities(),
                                                      simulations,
                                                      world.GameMode,
                                                      player.Permissions
                                                      );

            player.SendPacket(new TimeChange(eventTriggerer.ElapsedSeconds, true));
            player.SendPacket(initialPlayerSync);
        }
예제 #17
0
파일: Player.cs 프로젝트: xawler/Nitrox
 public Player(ushort id, string name, PlayerContext playerContext, NitroxConnection connection, Vector3 position, NitroxId playerId, Optional <NitroxId> subRootId, Perms perms, List <EquippedItemData> equippedItems, List <EquippedItemData> modules)
 {
     Id                 = id;
     Name               = name;
     PlayerContext      = playerContext;
     this.connection    = connection;
     Position           = position;
     SubRootId          = subRootId;
     GameObjectId       = playerId;
     Permissions        = perms;
     this.equippedItems = equippedItems;
     this.modules       = modules;
 }
예제 #18
0
 public PickupItem(Vector3 itemPosition, NitroxId id, TechType techType)
 {
     ItemPosition = itemPosition;
     Id           = id;
     TechType     = techType;
 }
예제 #19
0
        public void RepairEscapePodRadio(NitroxId id)
        {
            EscapePodModel escapePod = EscapePods.Find(ep => ep.RadioId == id);

            escapePod.RadioDamaged = false;
        }
예제 #20
0
 public CyclopsChangeSonarMode(NitroxId id, bool isOn)
 {
     Id   = id;
     IsOn = isOn;
 }
예제 #21
0
 public ConstructionAmountChanged(NitroxId id, float constructionAmount)
 {
     Id = id;
     ConstructionAmount = constructionAmount;
 }
예제 #22
0
 public void AddUpdate(NitroxId id, NitroxVector3 position, NitroxQuaternion rotation)
 {
     Updates.Add(new EntityTransformUpdate(id, position, rotation));
 }
예제 #23
0
 public Entity(Vector3 position, Quaternion rotation, Vector3 scale, TechType techType, int level, string classId, bool spawnedByServer, NitroxId waterParkId, byte[] serializedGameObject, bool existsInGlobalRoot, NitroxId id)
 {
     Position             = position;
     Rotation             = rotation;
     Scale                = scale;
     TechType             = techType;
     Id                   = id;
     Level                = level;
     ClassId              = classId;
     SpawnedByServer      = spawnedByServer;
     WaterParkId          = waterParkId;
     SerializedGameObject = serializedGameObject;
     ExistsInGlobalRoot   = existsInGlobalRoot;
 }
예제 #24
0
 public EntityTransformUpdate(NitroxId id, NitroxVector3 position, NitroxQuaternion rotation)
 {
     Id       = id;
     Position = position;
     Rotation = rotation;
 }
예제 #25
0
 public Optional <T> GetVehicleModel <T>(NitroxId id) where T : VehicleModel
 {
     return(Optional.OfNullable(GetVehicleModel(id).Value as T));
 }
예제 #26
0
 public ConstructionCompleted(NitroxId id, NitroxId baseId)
 {
     PieceId = id;
     BaseId  = baseId;
 }
예제 #27
0
 public bool HasExclusiveLock(NitroxId id)
 {
     return(PlayerHasMinLockType(id, SimulationLockType.EXCLUSIVE));
 }
예제 #28
0
        private Entity SpawnChild(Entity parentEntity, DeterministicBatchGenerator deterministicBatchGenerator, TechType techType, string classId)
        {
            NitroxId id = deterministicBatchGenerator.NextId();

            return(new Entity(new NitroxVector3(0, 0, 0), new NitroxQuaternion(0, 0, 0, 1), new NitroxVector3(1, 1, 1), techType.Model(), parentEntity.Level, classId, true, id, null, parentEntity));
        }
예제 #29
0
 public void SimulateEntity(NitroxId id, SimulationLockType lockType)
 {
     simulatedIdsByLockType[id] = lockType;
 }
예제 #30
0
 public void PlayStudioEmitter(NitroxId id, string assetPath, bool play, bool allowFadeout)
 {
     packetSender.Send(new PlayFMODStudioEmitter(id, assetPath, play, allowFadeout));
 }