X4: Foundations

X4: Foundations

Mining, Gas Collector and Raw Scrap Converter Stations
sprIder  [developer] 15 Mar @ 7:57am
How to: Changing model of a station of this mod
As asked:
Originally posted by Chewie2k:
... just one question; is there a way to change the model of the energy pylon? I find the current small version is just too big to be practical. If you could tell me if I can change it to use the model of say, the terran admin centre?

That is possible. But be aware: This can and will break existing stations. So before you change anything: dismantle them, save, change the mod and then rebuild them.

First of all
You need to have the game and my mod unpacked: https://forum.egosoft.com/viewtopic.php?t=402452

To change things at all, you have two options.
A) you can do the changes via an additional mod, which then changes the existing file and / or adds files.
If you want to change my files with your mod, the structure is something like:
X4 Foundations\extensions\yourmod\extensions\mining_station\...
This is perhaps more time-consuming, but also more sustainable. If I update my mod, your direct changes in my mod could be overwritten and will then be lost. This will likely not happen, if you use an additional mod.

B) you change the necessary file directly in my mod. In this case you must not have any .cat and .dat file left, just the unpacked files of this mod.
This may be quicker, but is probably not sustainable either.

I recommend A).

To change the model of the station, you must adapt the component file of the station macro. There are two possibilities.
1. either you create a new component file as a copy of your intended model, defence_ter_claim_01, to which you then refer.
2. you overwrite almost the complete, already existing component file with the data of your intended model.
Unfortunately, in your case it is not possible to simply refer to another component file, because the energy module belongs to the “production” class, but the admin center is a “defencemodule”.

Option I
You copy defence_ter_claim_01.xml from \extensions\ego_dlc_terran\assets\structures\defence into mine or into your mod and name it e.g. gen_s_energy_ter_claim.
That would be: \extensions\yourmod\assets\structures\production\gen_s_energy_ter_claim.xml
In this you change
<component name="defence_ter_claim_01" class="defencemodule">
to e.g.
<component name="gen_s_energy_ter_claim" class="production">
In the file you'll find another "defencemodule" which you also change to "production".
The name is your thing, as you like. But the change from "defencemodule" to "production" is important.

Then you change the following file in my mod or via replace in your mod: mining_station\assets\structures\production\macros\gen_s_energy_asteroid_macro.xml.
Here you have to change
<component ref="gen_s_energy_asteroid"/>
to
<component ref="gen_s_energy_ter_claim" />
-> same name as before.

And delete the section
<connections> <connection ref="connection_controlroom01"> <macro ref="control_room_macro" connection="connection01"/> </connection> </connections>
as there is no more corresponding connection in the component code.

To replace and delete it with a mod of your own, you would need a file in following folder and file structure:
X4 Foundations\extensions\yourmod\extensions\mining_station\assets\structures\production\macros\gen_s_energy_asteroid_macro.xml
-> the "double" of extensions is important.
Code for this file:
<?xml version="1.0" encoding="utf-8"?> <diff> <replace sel="/macros/macro/component/@ref">gen_s_energy_ter_claim</replace> <remove sel="//connections"/> </diff>

But the game needs to know, where it can find "gen_s_energy_ter_claim". So you have to add an entry in \index\components.xml for this new component-file.
<?xml version="1.0" encoding="utf-8" ?> <diff> <add sel="/index"> <entry name="gen_s_energy_ter_claim" value="extensions\mining_station_s_energy_ter_claim\assets\structures\production\gen_s_energy_ter_claim"/> </add> </diff>

Last but not least, you have to set a dependency in the content.xml file of your mod:
<dependency name="Cradle of Humanity" id="ego_dlc_terran" optional="false"/> <dependency id="mining_station" optional="true" name="Bergbau- und Gassammelstationen"/> <dependency id="ws_2653753970" optional="true" name="Bergbau- und Gassammelstationen"/>
With this the ego_dlc_terran is absolutely required. Since you have copied the file, but not referenced it, we want to be sure, that you really own the dlc.
And dependencies for the mining station mods. so that the load order of the game does everything sets correct. We set the dependency to both of the mod versions, Steam (id="ws_2653753970") and Dropbox.

If you only use the Steam version and never intend to publish your mod, it is sufficient to only require the Steam version:
<dependency name="Cradle of Humanity" id="ego_dlc_terran" optional="false"/> <dependency id="ws_2653753970" optional="false" name="Bergbau- und Gassammelstationen"/>

The result will look like this: mining_station_s_energy_ter_claim[www.dropbox.com]

Option II
  1. Open defence_ter_claim_01.xml from \extensions\ego_dlc_terran\assets\structures\defence and
    gen_s_energy_asteroid.xml from \extensions\\mining_station\assets\structures\production
  2. Overwrite everything in gen_s_energy_asteroid.xml from the fourth line onwards with the code from defence_ter_claim_01.xml from the fourth line onwards.
    -> So everything from
    <source geometry="extensions\ego_dlc_terran\assets\structures\defence\\defence_ter_claim_01_data"/>
    to the end.
  3. Make sure, that I/you have set a dependency to this dlc in the content.xml.

If you need help, just let me know.
Last edited by sprIder; 16 Mar @ 5:12am
< >
Showing 1-2 of 2 comments
Chewie2k 15 Mar @ 4:45pm 
This is awesome! Thank you so very much!
sprIder  [developer] 17 Mar @ 8:46am 
You're welcome. I'm happy to help you.
< >
Showing 1-2 of 2 comments
Per page: 1530 50