Traps in the game's code
Things in Alta's code that look like they work one way and don't, found while writing the type pages. Each was read from the decompiled server build, not tested in the game, so check the code before you rely on one. The type pages say more about each.
The server trusts the client
ProgressionSlotContainerbuys or sells a skill orb for its target player whenever any client asks (syncOperate). It never checks who asked.- The server applies any player state change a client asks for, checked only by that state's own
ValidateStateActivation. PurchasedList.ValidatePlayersOwnedItemsalways says yes, soCustomizationState.Synctakes whatever cosmetics a client sends.ImpactDetector.SyncImpacttakes a tool hit only from the tool's last holder, but hits by a tool on anything other than a player are decided on the swinging player's own game.PlayerControllerMultiLockModel: while any lock is held,PlayerHealthignores all damage, and the server takesIsLockedfrom the owning player's own message. A modified client can make itself unhurtable.- Fall damage:
SmoothLocomotionsends the fall distance and the server applies whatever it's told. SparkSecondaryDetectortakes a spark point (anywhere within 10 m) and an effectiveness from the client and starts fires from them.ClientSideNailHitSynctakes a client-reported effectiveness for nail damage on stations.SocialTabletActionSyncStruct: the server raises its report, ban and unban console events on the client's word alone, so those events can be faked.SpiritModeDoorwayapplies spirit mode with whateverPlayerUnlockthe client's message names.TwoStepLever,LongHoldInteractable,ItemShooter.SyncShootand bow shots (BowString) also act on the client's say-so.ServerSettingsSync.IsServerSyncPermittedalways says yes in the game. TavernLib limits it toownerandmoderator.InGameInspector's command tool runs any command a client sends it throughCommandService.Handle, with the only permission check on the client. No prefab in this build carriesInGameInspector, so nothing can reach it, but a mod that spawns one opens it up.
Limits that break quietly
Statvalues are packed into fixed ranges when they're sent to players: base, minimum and maximum 0 to 127, extras and multipliers -63 to 64, in steps of 0.01. A value outside those reaches players wrong.LocationChunkclamps positions to the chunk's box plus 10 units.PlayerUnlockManagersends orb indexes in 4 bits, so only 0 to 15 reach players correctly.EntityManagerhas 100,000 entity ids, and ids 0 and 1 of every block of 50 are markers, so about 96,000 are usable. A broken free list quits the server ("Corrupt entity list").OutgoingPacketManagerdisconnects a player once 64 reliable packets back up for them ("Reliable overflow").ChunkEntityManager.CompareFeetmeasures distance asx*x + z + z, so sending the nearest entities first (for Quest players) is out of order.
Names that mislead
HashedGeneralValue<T>.Get(string)takes the spaces out of the name but doesn't lowercase it, and the stored names are lowercase, so Get("Iron Ingot") finds nothing. Console arguments are lowercased first, so commands still work.PlayerStateBase.IsDecoratedis true when there is no decorator.- SplineDisplay.IsHeadlessOnly = true skips the display on a headless server.
- HoverPickup.teleportToTargetOnRelease = true makes the item fly back smoothly; false makes it snap.
AtmosphereManager.GetHighestPluginreturns the last enabled plugin, not the one with the highest priority.NetworkingStatistic.BytesPerFrameis the average bytes per message.MicroTutorialLogger.Warnlogs at Error.PlayerEffectManager.EffectPositionculling: any value other thannonehides the effect for local and remote players alike.
Things that run once, or never again
UpdateModuledrops an update callback for good the first time it throws, and logs only that first error.ServerBoard.OnRefreshFinishedis cleared after every refresh, so a handler fires once.FestivityManagerresets every festivity from its dates once a second, so settingIsActivatedor callingSetFestivityActivefrom a mod only lasts until the next check.VirtualKeyboard.ClearFocusremoves everyInputChangedandNextPressedlistener, not just yours.SenderInput.Destroydoesn't remove its own handler.
Saved but not loaded, declared but never used
Enchantablesaves its enchantments and itsLoadignores them.Ecosystemrebuilds its saved spawn points on load and then throws them away.TransformSaveCollection.Savesaves nothing.GrowthSaveData.positionandrotationare never filled in.- A
TimedStatModifierthat was loaded or received over the network doesn't callOnRemovedwhen it runs out. StatModifier.UpdateValuealways writes the buff fields, even on a modifier that isn't a buff.SerializedSavedDynamicObject.Loadis obsolete and spawns network entities twice; useLoadInto.- Save migrations that lose data:
FireSaveData1(fuel progress),LootModuleSaveData3and4(isOneOff, and the fail chance resets),EmbeddableSaveData1(embeds),GlobalPagesManagerSaveData1(every page),MovePickupSaveData1andLogicFloatChangeOnBoolSaveData2.CaveLayerManagerSaveData3.Migrateprobably throws.CookingPot's load never restores the cooking stage. SavingSystem.Reinitializeonly registers[SaveStructure]classes from the game's own assembly, so a mod's save data classes need a patch there to be saved at all.- Never raised:
StaticEnvironmentPieceInstance.Released,PlayerScreenFader.ScreenFaded. Never set:SteamVRPose.IsConnected,Beam.Parent,Command.Method,Spriggull.IdleStart,GenerationCore.IsDynamic. - Not read anywhere: most of
MiningSettings(only haptics, the strike sound value and drop speed are),ClimberSettings(climbing usesClimbingSettings),PickupTypeSettings.WeightMaxPerHandandWeightPenalty, and theseServerSettings:RespawnTimeSeconds,HandoverRequireConfirmation,AvoidSpawnCollectedPages,EmptyServerShutdownTimeInSeconds,WipesWhenEmpty,HasRunRepairBoxFix.
Items and the world
- Taking an item out of a
PickupDockstack spawns a new copy, so a reference to the docked one goes stale. BuildupPickupfills every child slot on spawn, whatever its minimum and maximum say; the random count only picks the starting slot.PositionRestrictorsnaps loose items outside its radius back, and yanks held ones back afterheldLimitseconds. Items that "teleport" in the tutorial or mould areas are usually this.- A container only pours into containers with a lower
ContainerPriority. DecraftingComponentonly knocks off outer parts (nothing attached to them), and needs a hit of at least 0.2.ChiselDefinition.GetBestpicks an exact match if there is one; otherwise it picks at random, weighted by the squared error, so worse matches are more likely.StewRecipe.PrefabQuantitiesonly counts prefabs with "Ripe" in their name.VelocityPickupSettingsgrip strengths only apply on clients; the server always uses 9 and 75.ForestGenerator.Wipeignores the seed you pass. See Resetting the forest.
Console commands
- Command methods must be static:
Command.Invokecalls them with no instance. - The
settingscommand ignores theJsonMin,JsonMaxandJsonRangelimits when it sets a whole number.
See also
- Known patch points, for what other mods already patch.
- The type browser, where each of these has its own page.