Breaking Changes

Version 24.1 by owen on 2019/02/15 09:19
Warning
For security reasons, the document is displayed in restricted mode as it is not the current version. There may be differences and errors due to this.

Introduction

Our goal is to keep breaking changes between any given version of X4 to an absolute minimum. In some cases, however, we have had to change things which break scripts/mods written for older versions.
The following table provides an overview about all breaking changes. This should help you to make any necessary changes to restore compatibility of older mods with new versions of X4.
Feel free to drop a note if a certain breaking change is breaking your mod and you have difficulties finding a way to work around the issue.

Unknown macro: note. Click on this message for details.

Warning
UI modding considered unstable until further notice...

Please note that UI modding must be considered unstable in the current version. While we are working hard to get the UI modding integration into a stable state, we might have to introduce larger backwards incompatibilities in the following patches. This means that you might have to modify any mod using UI modding capabilities to a larger extend to keep it compatible with certain patches. Still, we are doing our best not to unnecessarily break things for modders and certainly will announce such changes on this page here.

Breaking Changes

Type

Version

Summary

Scripts

2.00 Beta 1

<event_build_finished/> param2 now returns null instead of a construction sequence

The construction sequence which was finished should now be accessed via the buildtask provided via param3.

Scripts

2.00 Beta 1

param.boarding.{...} strength parameters removed

The 'recruitstrength', 'veteranstrength' and 'elitestrength' script parameters were no longer required for balancing the boarding gameplay, and were removed.

Scripts

2.00 Beta 1

$defensible.boardee/$defensible.boarder and <set_object_boarder/>/<remove_object_boarder/> removed

Due to changes to boarding in X4, the boarding connections accessed by these script properties and actions became redundent and thus, removed. Any connections set by these actions in a savegame will not survive loading.

UI extensions

2.00 Beta 1

FFI: GetUpgradeSlotCurrentComponent()/GetUpgradeSlotGroup() works on non-operationals

Before 2.0 Beta 1 using GetUpgradeSlotCurrentComponent() or GetUpgradeSlotGroup() only performed on operational objects (i.e. not wrecked objects or objects under construction). Since this is inconsistent with the rest of the UI functions, this was considered a bug and fixed in 2.0 Beta 1. If you require the old behavior, use the FFI function: IsComponentOperational() to check the passed object's state before making the call.

UI extensions

2.00 Beta 1

FFI: SetFormationShape() no longer indicates an error upon certain error cases

Before 2.0 Beta 1 a call to SetFormationShape() indicated an error state to the caller in certain cases where setting a formation shape (potentially) failed. Due to a design flaw in the handling of formations, this however doesn't do any good, since the function by itself doesn't really set the formation shape in all cases. On top of that the call can fail at random. Hence, at the moment an indication of an error case that setting a formation potentially fails is no good to the caller and he has no means to distinguish that case from a real error case.
Therefore, in 2.0 Beta 1 we drop the error indication in case of an attempt to set the formation fails. We are currently working on a better solution to the underlying problem and hope to have it ready as part of a following beta.

Scripts

2.00 Beta 1

<create_formation/> now requires the attributes: 'leader' and 'follower'. Attribute 'object' is now deprecated.

This now enforces a leader and at least one follower in order to create or change a formation.  Former implementation made it possible to create formations without any followers which led to issues.

Scripts

2.00 Beta 1

<event_player_changed_target/> now fires and returns null if the player deselects a target.

For prior behavior, check for event.param being non-null.

AI Scripts

2.00 Beta 1

<shoot/>/<shoot_at/> attribute changes.

Changed: Attribute "primary" is now optional and defines whether weapons from the ship's active primary weapon group will be fired. Defaults to true.
New attribute: "secondary" is an optional attribute that defines whether weapons from the ship's active secondary weapon group will be fired. Defaults to true.
New attribute: "missiles" is an optional attribute that defines whether only missile launchers will be used. If false, only guns will be fired. Defaults to false.

Corrects now-obsolete assumption that primary weapon groups only contain guns and secondary weapon groups only contain missile launchers.

UI extensions

2.00 Beta 1

FFI: GetBuildTask()/GetNumBuildTasks() got a new "buildmoduleid" parameter. 

Added possibility to query build tasks of a certain buildmodule.

UI extensions

2.00 Beta 1

Lua: GetLibraryEntry() retrieved a new "buildresources" field.

Added list of resources a buildmodule needs to build.

UI extensions

2.00 Beta 1

Lua: CalculateTotalHullFraction() was removed. 

Unused, derelict function from XR - use GetComponentData(..., "hullpercent") instead.

UI extensions

2.00 Beta 1

FFI: RequestDockAtReason()/UndockPlayerShip() changed their return values. 

Changed return value type to const char* to better identify failure reasons in Lua script.

UI extensions

1.50 Beta 3

Lua: GetComponentData() changed behavior of "docksizes" propertly. 

The "docksizes" property no longer includes internal ship storage docks.

All

1.50 Beta 2

Meaning of "Shipyard" was corrected throughout Lua/MD/AI scripts, so that Wharfs are not Shipyards (unlike in XR).

Shipyards (formerly also known as Capital Shipyards) can build capital ships, while Wharfs only build non-capital ships. To check whether a station is a Shipyard or a Wharf, check whether the station "can build ships".

Lua: Adjusted GetComponentData() and HasShipyard(), added HasWharf()
Lua / GetComponentData() properties: Removed "iscapitalshipyard", fixed "isshipyard", added "canbuildships", "iswharf", "isequipmentdock"
Scripts: Fixed property .isshipyard, added .iswharf (.canbuildships existed already)

UI extensions

1.50 Beta 2

FFI: UpgradeGroupInfo datatype was changed. 

Added new "operational" field to retrieve information about number of operational upgrades in a group.

UI extensions

1.50 Beta 1

FFI: SetGuidance() removed useinfopoint argument.

In X Rebirth "info points" existed (which were mainly used as interaction points to scan stations/access information about modules). These were removed in X4 but this left-over property here was missed to be removed in-time for release. It was therefore removed now in order to move towards a stable/clean UI API.

The new function declaration is: void SetGuidance(UniverseID componentid, UIPosRot offset)

UI extensions

1.50 Beta 1

FFI: CancelConstruction() changed its return value. 

CancelConstruction() now returns if the cancellation was successful. 

UI extensions

1.32

Lua: GetComponentData() removed the "nextdestname" property.

Instead of "nextdestname", use the properties "destination" or "destinationsector" to retrieve a destination component, then retrieve its "name" property.

UI extensions

1.20

FFI: GetAAOption() got a new "useconfig" parameter. 

The AA setting was changed to check the new setting with the user. In order to restore the old setting GetAAOption() gets the option to retrieve the config settings.