// Happens each time a progress is made public static void ProgressCallback() { PDAScanner.ScanTarget scanTarget = PDAScanner.scanTarget; if (scanTarget.techType == TechType.Player) { return; } if (scanTarget.isValid && scanTarget.progress > 0f && scanTarget.gameObject.TryGetComponent(out NitroxEntity nitroxEntity)) { // Should always be the same for the same entity NitroxId nitroxId = nitroxEntity.Id; DateTimeOffset Now = DateTimeOffset.UtcNow; // Start a thread when a scanning period starts if (!ThrottlingEntries.TryGetValue(nitroxId, out ThrottledEntry throttledEntry)) { ThrottlingEntries.Add(nitroxId, throttledEntry = new ThrottledEntry(scanTarget.techType, nitroxId, new PDAScanner.Entry() { techType = scanTarget.techType, progress = scanTarget.progress })); throttledEntry.StartThrottler(); } PDAScanner.Entry scannerEntry = throttledEntry.GetEntry(); // Updating the progress throttling throttledEntry.Update(Now, null, scanTarget.progress); // Throttling the packet sending if (Now.ToUnixTimeMilliseconds() < throttledEntry.LatestPacketSendTime.ToUnixTimeMilliseconds() + PACKET_SENDING_RATE) { return; } NitroxTechType nitroxTechType = new NitroxTechType(scanTarget.techType.ToString()); // This should not occur all the time because it only takes effect one time per entity // Then it occurs when someone else already scanned the entity // Check if the entry is already in the partial list, and then, change the progress if (PDAManagerEntry.CachedEntries.TryGetValue(nitroxTechType, out PDAProgressEntry pdaProgressEntry)) { if (pdaProgressEntry.Entries.TryGetValue(nitroxId, out float progress)) { pdaProgressEntry.Entries.Remove(nitroxId); // We'd like the progress to not decrease when two people scan the same thing at the same time if (scannerEntry.progress < progress) { PDAScanner.scanTarget.progress = progress; scannerEntry.progress = progress; } if (pdaProgressEntry.Entries.Count == 0) { PDAManagerEntry.CachedEntries.Remove(nitroxTechType); } } } throttledEntry.Update(Now, Now, scanTarget.progress); PDAManagerEntry.Progress(throttledEntry.GetEntry(), nitroxId); } }
public PDAEntryProgress(NitroxTechType techType, float progress, int unlocked, NitroxId nitroxId) { TechType = techType; Progress = progress; Unlocked = unlocked; NitroxId = nitroxId; }
} // If it's the first time the player used that item type it send the techType, if not null. public PlayerHeldItemChanged(ushort playerId, NitroxId itemId, ChangeType type, NitroxTechType isFirstTime) { PlayerId = playerId; ItemId = itemId; Type = type; IsFirstTime = isFirstTime; }
public NeptuneRocketModel(NitroxTechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, List <InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional <NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health) : base(techType, id, position, rotation, interactiveChildIdentifiers, dockingBayId, name, hsb, health) { CurrentStage = 0; ElevatorUp = false; ConstructorId = new NitroxId(); //The ID will be set forever and will be fetched once a rocket base platform starts (see Rocket_Start_Patch) }
public LiveMixinHealthChanged(NitroxTechType techType, NitroxId id, float lifeChanged, float totalHealth) { TechType = techType; Id = id; LifeChanged = lifeChanged; TotalHealth = totalHealth; DamageTakenData = Optional.Empty; }
public UweWorldEntity(NitroxTechType techType, NitroxVector3 scale, string classId, string slotType, int cellLevel) { TechType = techType; Scale = scale; ClassId = classId; SlotType = slotType; CellLevel = cellLevel; }
public SeamothModulesAction(NitroxTechType techType, int slotID, NitroxId id, NitroxVector3 forward, NitroxQuaternion rotation) { TechType = techType; SlotID = slotID; Id = id; Forward = forward; Rotation = rotation; }
public DroppedItem(NitroxId id, Optional <NitroxId> waterParkId, NitroxTechType techType, NitroxVector3 itemPosition, NitroxQuaternion itemRotation, byte[] bytes) { Id = id; WaterParkId = waterParkId; ItemPosition = itemPosition; ItemRotation = itemRotation; TechType = techType; Bytes = bytes; }
public void EntryProgressChanged(NitroxTechType techType, float progress, int unlocked) { if (!PartiallyUnlockedByTechType.TryGetValue(techType, out PDAEntry pdaEntry)) { PartiallyUnlockedByTechType[techType] = pdaEntry = new PDAEntry(techType, progress, unlocked); } pdaEntry.Progress = progress; pdaEntry.Unlocked = unlocked; }
public static void Prefix(QuickSlots __instance, int slotID, ref NitroxTechType __state) { InventoryItem item = ((InventoryItem[])bindingField.GetValue(__instance))[slotID]; if (item == null) { return; } __state = Player.main.IsToolUsed(item.item.GetTechType()) ? item.item.GetTechType().ToDto() : null; }
public CyclopsModel(NitroxTechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, List <InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional <NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health) : base(techType, id, position, rotation, interactiveChildIdentifiers, dockingBayId, name, hsb, health) { FloodLightsOn = true; InternalLightsOn = true; SilentRunningOn = false; ShieldOn = false; SonarOn = false; EngineState = false; EngineMode = CyclopsMotorMode.CyclopsMotorModes.Standard; }
public LiveMixinHealthChanged(NitroxTechType techType, NitroxId id, float lifeChanged, float totalHealth, NitroxVector3 position, ushort damageType, Optional <NitroxId> dealerId) { TechType = techType; Id = id; LifeChanged = lifeChanged; TotalHealth = totalHealth; DamageTakenData = new DamageTakenData { Position = position, DamageType = damageType, DealerId = dealerId }; }
public void UnlockedTechType(NitroxTechType techType) { PartiallyUnlockedByTechType.Remove(techType); CachedProgress.Remove(techType); if (!UnlockedTechTypes.Contains(techType)) { UnlockedTechTypes.Add(techType); } else { Log.Debug($"There was an attempt of adding a duplicated entry in the UnlockedTechTypes: [{techType.Name}]"); } }
public static void Postfix(InventoryItem ____heldItem, NitroxTechType __state) { if (____heldItem == null) { return; } Pickupable pickupable = ____heldItem.item; NitroxId itemId = NitroxEntity.GetId(pickupable.gameObject); PlayerTool component = pickupable.GetComponent <PlayerTool>(); PlayerHeldItemChanged.ChangeType type = component ? PlayerHeldItemChanged.ChangeType.DRAW_AS_TOOL : PlayerHeldItemChanged.ChangeType.DRAW_AS_ITEM; player.BroadcastHeldItemChanged(itemId, type, __state); }
public ConstructorBeginCrafting(NitroxId constructorId, NitroxId constructeditemId, NitroxTechType techType, float duration, List <InteractiveChildObjectIdentifier> interactiveChildIdentifiers, NitroxVector3 position, NitroxQuaternion rotation, string name, NitroxVector3[] hsb, float health) { ConstructorId = constructorId; ConstructedItemId = constructeditemId; TechType = techType; Duration = duration; InteractiveChildIdentifiers = interactiveChildIdentifiers; Position = position; Rotation = rotation; Name = name; HSB = hsb; Health = health; }
public static VehicleModel BuildFrom(NitroxTechType techType, NitroxId constructedItemId, NitroxVector3 position, NitroxQuaternion rotation, List <InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional <NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health) { switch (techType.ToUnity()) { case TechType.Seamoth: return(new SeamothModel(techType, constructedItemId, position, rotation, interactiveChildIdentifiers, Optional.Empty, name, hsb, health)); case TechType.Exosuit: return(new ExosuitModel(techType, constructedItemId, position, rotation, interactiveChildIdentifiers, Optional.Empty, name, hsb, health)); case TechType.Cyclops: return(new CyclopsModel(techType, constructedItemId, position, rotation, interactiveChildIdentifiers, Optional.Empty, name, hsb, health)); case TechType.RocketBase: return(null); default: throw new Exception($"Could not build from: {techType}"); } }
public FabricatorItemPickup(NitroxId fabricatorId, NitroxTechType techType) { FabricatorId = fabricatorId; TechType = techType; }
public ExosuitModel(NitroxTechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, List <InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional <NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health) : base(techType, id, position, rotation, interactiveChildIdentifiers, dockingBayId, name, hsb, health) { LeftArmId = new NitroxId(); RightArmId = new NitroxId(); }
public static TechType ToUnity(this NitroxTechType v) { return((TechType)Enum.Parse(typeof(TechType), v.Name)); }
public KnownTechEntryAdd(NitroxTechType techType, bool verbose) { TechType = techType; Verbose = verbose; }