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"); } }
public bool HasAnyLockType(NitroxId id) { return(PlayerHasMinLockType(id, SimulationLockType.TRANSIENT)); }
public void RequestSimulationLock(NitroxId id, SimulationLockType lockType) { SimulationOwnershipRequest ownershipRequest = new SimulationOwnershipRequest(muliplayerSession.Reservation.PlayerId, id, lockType); packetSender.Send(ownershipRequest); }
private void SetPlayerGameObjectId(NitroxId id) { NitroxIdentifier.SetNewId(Player.mainObject, id); Log.Info("Received initial sync Player GameObject Id: " + id); }
public void RemoveVehicle(NitroxId id) { RemoveItemsFromVehicle(id); vehiclesById.Remove(id); }
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; }
public PingRenamed(NitroxId id, string name, byte[] beaconGameObjectSerialized) { Id = id; Name = name; BeaconGameObjectSerialized = beaconGameObjectSerialized; }
public SimulationOwnershipResponse(NitroxId id, bool lockAquired, SimulationLockType lockType) { Id = id; LockAquired = lockAquired; LockType = lockType; }
public CyclopsChangeSilentRunning(NitroxId id, bool isOn) { Id = id; IsOn = isOn; }
public FabricatorItemPickup(NitroxId fabricatorId, NitroxTechType techType) { FabricatorId = fabricatorId; TechType = techType; }
public VehicleDestroyed(NitroxId id, string playerName, bool getPilotingMode) { Id = id; PlayerName = playerName; GetPilotingMode = getPilotingMode; }
public EquippedItemData(NitroxId containerId, NitroxId itemId, byte[] serializedData, string slot, TechType techType) : base(containerId, itemId, serializedData) { Slot = slot; TechType = techType; }
public CyclopsFireSuppression(NitroxId id) { Id = id; }
public static void Prefix(BaseDeconstructable __instance) { NitroxId id = NitroxEntity.GetId(__instance.gameObject); TransientLocalObjectManager.Add(TransientObjectType.LATEST_DECONSTRUCTED_BASE_PIECE_GUID, id); }
public FabricatorBeginCrafting(NitroxId fabricatorId, TechType techType, float duration) { FabricatorId = fabricatorId; TechType = techType; Duration = duration; }
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); }
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; }
public PickupItem(Vector3 itemPosition, NitroxId id, TechType techType) { ItemPosition = itemPosition; Id = id; TechType = techType; }
public void RepairEscapePodRadio(NitroxId id) { EscapePodModel escapePod = EscapePods.Find(ep => ep.RadioId == id); escapePod.RadioDamaged = false; }
public CyclopsChangeSonarMode(NitroxId id, bool isOn) { Id = id; IsOn = isOn; }
public ConstructionAmountChanged(NitroxId id, float constructionAmount) { Id = id; ConstructionAmount = constructionAmount; }
public void AddUpdate(NitroxId id, NitroxVector3 position, NitroxQuaternion rotation) { Updates.Add(new EntityTransformUpdate(id, position, rotation)); }
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; }
public EntityTransformUpdate(NitroxId id, NitroxVector3 position, NitroxQuaternion rotation) { Id = id; Position = position; Rotation = rotation; }
public Optional <T> GetVehicleModel <T>(NitroxId id) where T : VehicleModel { return(Optional.OfNullable(GetVehicleModel(id).Value as T)); }
public ConstructionCompleted(NitroxId id, NitroxId baseId) { PieceId = id; BaseId = baseId; }
public bool HasExclusiveLock(NitroxId id) { return(PlayerHasMinLockType(id, SimulationLockType.EXCLUSIVE)); }
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)); }
public void SimulateEntity(NitroxId id, SimulationLockType lockType) { simulatedIdsByLockType[id] = lockType; }
public void PlayStudioEmitter(NitroxId id, string assetPath, bool play, bool allowFadeout) { packetSender.Send(new PlayFMODStudioEmitter(id, assetPath, play, allowFadeout)); }