Skip to end of metadata
Go to start of metadata
Icon

Note that X Rebirth 4.21 was not released. Instead the version following 4.21 Beta 1 was 4.22 Beta 2.

For X Rebirth VR Edition this applies to the change from 4.21 (Hotfix 1) -> 4.22.

Empty missile cycle

In XR 4.22 Beta 2 we changed the missile cycle handling and introduced a new empty cycle step. This means that by switching through the missiles (f.e. by clicking on the second weapon monitor or pressing "M" (default mapping)) eventually you will switch to the empty cycle. When you are at that cycle step, a call to GetSecondaryShipWeapon() will return nil.

This is considered a breaking change, since if you checked via the FFI function C.GetNumSecondaryWeapons() (introduced in 4.20) whether weapons exist, before 4.21 Beta 2 you could rely on GetSecondaryShipWeapon() never returning nil. As of 4.22 Beta 2 this however can now return nil and you'd check for that case to correctly handle the new empty missile cycle entry.

If you have trouble applying the suggested fix, feel free to leave a comment here.

Changed behavior for 4.20 introduced FFI weapon functions

See XRUIMOD-254 - Data cannot be retrieved due to an unexpected error for details and a list of which FFI functions this applies to.

In 4.20 we introduced new functions to handle cycling the player ship weapons and retrieve the number of weapons. These functions originally performed in the context of the player's current controlled defensible object which normally is the player ship but can also be a remote controlled drone or missile. While this behavior opens up new possibilities for mods (f.e. allow drones with multiple weapons which can be cycled), it can result in some unexpected behavior if the code is not aware that it's context sensitive and the context changed (f.e. the player entered a remote controlled drone). In addition to that, all other existing weapon related functions (like the Lua function: Get[Primary/Secondary]ShipWeapon()) explicitly perform on the player ship; hence, having the new functions perform on the controlled defensible introduced an inconsistency here.

To resolve these concerns we decided to make an exception to our policy of not introducing breaking changes in already released non-beta versions here (also note that XR 4.20 was not released for XR; so practically we are not breaking things in released versions) and changed the behavior of the functions introduced in 4.20 to now be performed exclusively on the player ship.