SE v202 modding & scripting changes - THDigi/SE-ModScript-Examples GitHub Wiki

I compared the decompiled Space Engineers' game code for v202.124 against v201.014 and this is what I found that is relevant to modding and scripting (including PB).

For server admins (affects ModAPI too):

  • v202.124 additions:

    • Dedicated server config (IMyDedicatedConfig) got RemoteApiIP.
  • v202.112 additions:

    • Dedicated server config (IMyDedicatedConfig) had string WorldPlatform replaced with bool CrossPlatform.
  • World settings got (MyAPIGateway.Session.SessionSettings):

    • EnableSpaceSuitRespawn=true (Enables player to respawn in space suit)
    • MatchRestartWhenEmptyTime=0 (Server will restart after specified time [minutes], when it's empty after match started. Works only in PvP scenarios. When 0 feature is disabled.)
    • EnableFactionVoiceChat=false (Faction Voice Chat removes the need of antennas and broadcasting of the character for faction.)
    • EnableOrca=true (Enable advanced Optimal Reciprocal Collision Avoidance)
    • MaxProductionQueueLength=50 (Maximum allowed length of a production queue. Can affect performance.)

SBC modding/modelling (affects modAPI too)

  • v202.112 additions:

    • Fonts (folder) got 3 new characters (the platform icons) which are added before every player's name.
    • Fonts.sbc got a SwappedPath attribute per <Path> tag which is used in PlayStation when "AreEnterBackButtonsSwapped" which is never true on PC (also we don't have the XML they point to, gonna be tricky for mod.io font mods).
  • New block types:

    • EventControllerBlock (CubeBlocks_Automation.sbc)
    • PathRecorderBlock (CubeBlocks_Automation.sbc)
    • BasicMissionBlock (CubeBlocks_Automation.sbc)
    • FlightMovementBlock (CubeBlocks_Automation.sbc)
    • DefensiveCombatBlock (CubeBlocks_Automation.sbc)
    • OffensiveCombatBlock (CubeBlocks_Automation.sbc)
    • EmotionControllerBlock (CubeBlocks_GridAiPack.sbc)
  • All block definitions got:

    • <EnableUseObjectSimpleTargeting> (bool, defaults false) which if set true I think ignores the visual model when targetting an UseObject (terminal, inventory, etc)
    • <MechanicalTopInitialPlacementOffset> (Vector3, defaults null) which is used only by rotors/pistons/suspensions to offset the top part spawn point, used by 2x2 suspensions.
  • Camera block got a camera dummy option which is used for position offset only (no rotation).

  • AirVent definition got <RotationSpeed>, <SpinUpSpeed>, <SpinDownSpeed>.

    • these are for the new rotating subpart support, which grabs the very first subpart it finds no matter the name.
  • Missile ammo definition got <MissileRicochetAngle> (float, -1, degrees), <MissileRicochetDamage> (float, 0), <MissileRicochetProbability> (float, 0)

  • EntityComponents got a <RemoveExistingComponentOnNewInsert> (bool, true), where setting it false allows this component to be used multiple times on the same entity.

PB API (affects ModAPI too):

  • Detailed info got color support (bottom right in terminal):

    • [color=#AARRGGBB] for custom colors (in hex format), [/color] closing tag.
    • surround with [ and ] for yellow.
    • to print [ or ] without coloring, use [[ or ]].
  • New objects:

    • IMyEventControllerBlock
    • IMyOffensiveCombatBlock
    • IMyDefensiveCombatBlock
    • IMyBasicMissionBlock
    • IMyFlightMovementBlock
    • IMyPathRecorderBlock
    • IMyEmotionControllerBlock
    • IMySearchlight
    • IMyWindTurbine
    • and a few others that are accessible from the interfaces above.
  • IMyOxygenTank was removed (it was obsolete for several years).

  • IMyThrust got CurrentThrustPercentage.

  • IMyPistonBase got NormalizedPosition.

  • IMyTurretControlBlock got IsSunTrackerEnabled.

  • IMyShipConnector's IsConnected is no longer tagged obsolete.

  • IMyCubeGrid got LinearVelocity and Speed (accessible via block.CubeGrid).

  • IMyInventory got VolumeFillFactor.

  • Vector3D&Vector3 got a static Angle().

  • ⚠️ Caution: Vector3D&Vector3 got an instanced Normalized() which returns Vector3[D].Normalize(this), easily mistaken for Normalize() which mutates the vector.

  • ⚠️ Caution: Vector2 and Vector2D are now implicitly castable (accidental precision loss).

  • BoundingBoxD&MyOrientedBoundingBoxD got GetCorner().

ModAPI:

  • v202.112 additions:

    • MyEntity got UpdateDuration (get only, overrideable by custom entity classes).
    • MyRenderComponentBase.TextureChanges (Entity.Render) changed from string key to MyStringId key.
    • [I]MyEntity.SetTextureChangesForSubparts() changed its dictionary parameter from string key to MyStringId key.
      NOTE: the previous method still exists and it allocates a new dictionary!
    • IMyDedicatedConfig had string WorldPlatform replaced with bool CrossPlatform.
    • MyLog got ReportCodeLine().
    • MyUtils got GetFixedInvalidFileNameChars() and GetFixedInvalidPathChars().
  • New objects:

    • IMyStoredPowerRatio (cast a power-storing block or component to it).
    • IMyComponentStack (access from IMySlimBlock.ComponentStack).
    • MyModAPINaturalGravityComponent, IMyModAPINaturalGravityComponent, IMyNaturalGravityComponent (see MyAPIGateway.GravityProviderSystem).
    • MyAutopilotComponent
    • IMyEventControllerEntityComponent, IMyEventComponentWithGui
    • IMyWorkAreaTool (cast ship tools to it)
  • MyFakes.ENABLE_TYPES_FROM_MODS was set to true which means custom OBs can be declared in mods.

  • PathUtils.GetFilesRecursively() was added... ⚠️ it restricts to local mods folder and user folder only, it won't work after mod is published.

  • MyAPIGateway.GravityProviderSystem was added which can get/add/remove gravity providers.

  • MyGamePruningStructure.Instance was added which cloned all methods there, can't tell if there's new stuff.

  • MyRadioBroadcasters was made public.

  • MyCubeGrid changes:

    • ColorBlocks() and SkinBlocks() lost the validateOwnership arg.
    • ColorGridOrBlockRequestValidation() lost its player arg.
    • ContainerOpened() and CompetetiveContainerOpened() got an entityId arg.
    • lost 2 overloads of BuildBlockRequest(), lost RequestSetToConstruction().
    • lost a bunch of methods regarding multiblocks (which is not a supported SE feature anyway).
    • got ChangePowerProducerState(), BlocksWaitingOnAttachUpdate, InternalInitFinished, NaturalGravity, LockedByCount.
    • got GetConnectedGrids(GridLinkTypeEnum, Action\<MyCubeGrid\>), MechanicalConnectionBlockAttachUpdateStatusChanged().
    • got static ShowAiInfo.
    • got events: OnMinMaxChanged, OnConnectionChangeCompleted, OnTargetLockLost, OnDeschedule.
  • IMyCubeGrid got GetMaxThrustInDirection(), RvoAgentId, IsBlockTrasferInProgress, NaturalGravity.

  • IMyCubeGrid got events: OnGridBlockDamaged, OnTargetLocked, OnNaturalGravityChanged, SpeedChanged, OnMaxThrustChanged, OnBlockIntegrityChanged.

  • IMyGridControlSystem got CurrentShipController (accessible from grid.ControlSystem).

  • IMyGridGasSystem got ForcePressurize (accessible from grid.GasSystem; NOTE: server-side only).

  • IMySlimBlock got ComponentStack, BlockGeneralDamageModifier, IsMovedBySplit.

  • MyCubeBlock's ResourceSink setter is now accessible, got GetEmissiveStateHashFromComponent, OnUpdateBeforenextFrame events.

  • IMyCubeBlock got CubeGridChanged event.

  • IMyTerminalBlock got IsDetailedInfoDirty, ClearDetailedInfo(), GetDetailedInfo(), SetDetailedInfoDirty().

  • IMyControllableEntity got IsAutopilotControlled, RelativeDampeningDistance and RelativeDampeningTarget.

  • MyRemoteControl has a billion changes...

  • MyShipController's Priority getter was made public.

  • IMyCockpit got, IsOccupied, IsOccupiedChanged.

  • MyDoorBase got OpenChanged event.

  • IMyDoor got OnDoorOpen, OnDoorClosed events.

  • IMyThrust got ThrustChanged event.

  • IMyMechanicalConnectionBlock got OnAttachedChanged event.

  • IMyMotorStator got AngleChanged event.

  • IMyPistonBase got NormalizedPositionChanged event.

  • IMyShipConnector got IsConnectedChanged and AttachFinished events.

  • IMyShipMergeBlock got MergeStateChanged event.

  • IMyPowerProducer got CurrentOutputRatioChanged event.

  • IMyStoreBlock got CreateStoreItem() (4 overloads), GetStoreItems(), GetStoreItemById(), InsertStoreItem(), RemoveStoreItem().

  • IMyInventory got OnVolumeChanged event.

  • IMyCharacter got CharacterGeneralDamageModifier.

  • IMyConfigDedicated got DedicatedId.

  • MyEntities got IsShapePenetrating() (which we cannot use because it asks for HkShape).

  • MyEntities' TestPlaceInSpace() got 2 new args.

  • MyGridTargeting got many changes.

  • MyPhysics.CollisionLayers got OpenableSubpartLayer (4).

  • MyVisualScriptLogicProvider got TriggerTimerBlockForNonFriendlyPlayer(), GetPlayerRespawnPoints(), GoToPostMatchState(), ReportMatchEndToAnalytics(), SetScenarioWinTypeForAnalytics().

  • Setting MyEntity.Name now automatically calls MyEntitiesInterface.SetEntityName().

  • Billboard reflections now work:

⚠️ **GitHub.com Fallback** ⚠️