Diff code to add mining to all turrets on a ship?
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Diff code to add mining to all turrets on a ship?
How would you do a diff file to add the word mining into every turret definition for a ship?
Is that even possible?
If so, can someone post the code for it?
With the XL miners mod defunct, I'm trying to modify the only ship mod I have working to also work as a miner.
But I've no idea how to do the diff file to add mining onto every turret, and there's too many to do each one, plus I'm not even sure how to do each one for a diff file. The ship is an XL. I've got gas mining going fine, but need the turrets changed to mount mining turrets, without which it won't mine solids.
If need be, if I only get one turret changed, that might be enough. But I need the diff code for that, or at least an example of it I can follow to do the right code.
Anyone help with some code?
Is that even possible?
If so, can someone post the code for it?
With the XL miners mod defunct, I'm trying to modify the only ship mod I have working to also work as a miner.
But I've no idea how to do the diff file to add mining onto every turret, and there's too many to do each one, plus I'm not even sure how to do each one for a diff file. The ship is an XL. I've got gas mining going fine, but need the turrets changed to mount mining turrets, without which it won't mine solids.
If need be, if I only get one turret changed, that might be enough. But I need the diff code for that, or at least an example of it I can follow to do the right code.
Anyone help with some code?
-
- Posts: 135
- Joined: Sat, 3. Jul 10, 23:23
Re: Diff code to add mining to all turrets on a ship?
I don't know if there is an easier way, but: Replace the tags of every turret.
Example: Argon carrier, the old one. File: ship_arg_xl_carrier_01.xml at "\assets\units\size_xl"
You maybe want to copy that file to the same file structure in your mod: extensions\YourMod\assets\units\size_xl\ship_arg_xl_carrier_01.xml
Now, your diff code needs to catch the corresponding turret and replace the tags:
Part of the original code:
Your code
This "replace code" would be needed then for every turret.
Just adding the tag "mining" seems not to work:
I hope this helps.
Example: Argon carrier, the old one. File: ship_arg_xl_carrier_01.xml at "\assets\units\size_xl"
You maybe want to copy that file to the same file structure in your mod: extensions\YourMod\assets\units\size_xl\ship_arg_xl_carrier_01.xml
Now, your diff code needs to catch the corresponding turret and replace the tags:
Part of the original code:
Code: Select all
<components>
<component name="ship_arg_xl_carrier_01" class="ship_xl">
...
<connection name="con_turret_l_001" group="group_up_mid_mid " tags="turret large standard missile combat ">
<offset>
<position x="0" y="159.3311" z="-242.3653"/>
</offset>
</connection>
...
</connections>
</component>
</components>
Code: Select all
<?xml version="1.0"?>
<diff>
<replace sel="//connection[@name='con_turret_l_001']/@tags">turret large standard missile combat mining </replace>
</diff>
Just adding the tag "mining" seems not to work:
Code: Select all
<?xml version="1.0"?>
<diff>
<add sel="//connection[@name='con_turret_l_001']/@tags"> mining </add>
</diff>
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Re: Diff code to add mining to all turrets on a ship?
Great, thanks.
With luck, only one turret will be needed. Or maybe 3 or 4 tops.

With luck, only one turret will be needed. Or maybe 3 or 4 tops.
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Re: Diff code to add mining to all turrets on a ship?
Not working. The tags on the turret display are not changing, and no mining guns showing. And yet, there is nothing in the debug at all for the file.
This is the actual original code:
Any suggestions?
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="con_turret_001" tags="turret medium mining standard missile hittable combat " />
</replace>
<replace sel="con_turret_002" tags="turret medium mining standard missile hittable combat " />
</replace>
<replace sel="con_turret_003" tags="turret medium mining standard missile hittable combat " />
</replace>
<replace sel="con_turret_004" tags="turret medium mining standard missile hittable combat " />
</replace>
<replace sel="con_turret_005" tags="turret medium mining standard missile hittable combat " />
</replace>
<replace sel="con_turret_006" tags="turret medium mining standard missile hittable combat " />
</replace>
<replace sel="con_turret_007" tags="turret medium mining standard missile hittable combat " />
</replace>
<replace sel="con_turret_008" tags="turret medium mining standard missile hittable combat " />
</replace>
<replace sel="con_turret_009" tags="turret medium mining standard missile hittable combat " />
</replace>
<replace sel="con_turret_010" tags="turret medium mining standard missile hittable combat " />
</replace>
<replace sel="con_turret_laser_l_01" tags="turret large mining standard missile combat " />
</replace>
<replace sel="con_turret_laser_l_02" tags="turret large mining standard missile combat " />
</replace>
<replace sel="con_turret_laser_l_03" tags="turret large mining standard missile combat " />
</replace>
<replace sel="con_turret_laser_l_04" tags="turret large mining standard missile combat " />
</replace>
<replace sel="con_turret_laser_l_05" tags="turret large mining standard missile combat " />
</replace>
<replace sel="con_turret_laser_l_06" tags="turret large mining standard missile combat " />
</replace>
<replace sel="con_turret_laser_l_07" tags="turret large mining standard missile combat " />
</replace>
<replace sel="con_turret_laser_l_08" tags="turret large mining standard missile combat " />
</replace>
</diff>
Code: Select all
<connection name="con_turret_02" group="group_back_mid_right" tags="turret medium standard missile hittable combat">
<offset>
<position x="38.10917" y="4.43782" z="-224.1925"/>
<quaternion qx="-2.065182E-07" qy="3.441969E-07" qz="0.7071068" qw="-0.7071068"/>
</offset>
</connection>
-
- Posts: 19
- Joined: Sun, 12. Jan 14, 23:05
Re: Diff code to add mining to all turrets on a ship?
Comparing it to SprIder 's code, the "replace sel=" part of the code isn't right. It should look something like this.
Also if you're only changing a few turrets, make sure that you change all the turrets in the same group, otherwise it likely won't work.
Code: Select all
<replace sel="//connection[@name='con_turret_001']/@tags">turret medium mining standard missile hittable combat </replace>
Shame it doesn't work, would make combining mods with different weapon tags a lot easier. My guess is that it doesn't appended "mining" into "tag", but instead makes it a child of "connection" or "tag".sprIder wrote: ↑Thu, 8. Aug 24, 19:13 Just adding the tag "mining" seems not to work:Code: Select all
<?xml version="1.0"?> <diff> <add sel="//connection[@name='con_turret_l_001']/@tags"> mining </add> </diff>
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Re: Diff code to add mining to all turrets on a ship?
That isn't the same code as I have in my mods, so maybe that's why other things don't work now. They changed the format of the diff code?YellowBelllyBlackSnake wrote: ↑Fri, 9. Aug 24, 10:27 Comparing it to SprIder 's code, the "replace sel=" part of the code isn't right. It should look something like this.Also if you're only changing a few turrets, make sure that you change all the turrets in the same group, otherwise it likely won't work.Code: Select all
<replace sel="//connection[@name='con_turret_001']/@tags">turret medium mining standard missile hittable combat </replace>
I'll try that and see what happens.
I think that code replaces the original tags with just mining. Just guessing, but without the combat tag, the ship won't fire to protect itself.Shame it doesn't work, would make combining mods with different weapon tags a lot easier. My guess is that it doesn't appended "mining" into "tag", but instead makes it a child of "connection" or "tag".sprIder wrote: ↑Thu, 8. Aug 24, 19:13 Just adding the tag "mining" seems not to work:Code: Select all
<?xml version="1.0"?> <diff> <add sel="//connection[@name='con_turret_l_001']/@tags"> mining </add> </diff>
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Re: Diff code to add mining to all turrets on a ship?
Changing the code didn't work either.
This is what it looks like now.
I did originally try doing a custom version of ship_spl_xl_carrier_01.xml, but I must have missed entries for it in other files, since that didn't work either.

This is what it looks like now.
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="//connection[@name='con_turret_001']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_002']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_003]/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_004']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_005']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_006']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_007']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_008']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_009']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_010']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_01']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_02']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_03']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_04']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_05']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_06']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_07']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_08']/@tags">turret large mining standard missile combat </replace>
</diff>
-
- Posts: 19
- Joined: Sun, 12. Jan 14, 23:05
Re: Diff code to add mining to all turrets on a ship?
Just tried your code and it does work, but only group L2 and M5 has mining turrets. I did find that the format of the names of the large turrets changes slightly after the first two, which is why only group L2 has mining turrets.
Here's the code with the names fixed up.
Here's the code with the names fixed up.
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="//connection[@name='con_turret_001']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_002']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_003]/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_004']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_005']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_006']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_007']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_008']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_009']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_010']/@tags">turret medium mining standard missile hittable combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_01']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_02']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_003']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_004']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_005']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_006']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_007']/@tags">turret large mining standard missile combat </replace>
<replace sel="//connection[@name='con_turret_laser_l_008']/@tags">turret large mining standard missile combat </replace>
</diff>
I don't think anything has changed with the formatting of diff code.apricotslice wrote: ↑Fri, 9. Aug 24, 11:12That isn't the same code as I have in my mods, so maybe that's why other things don't work now. They changed the format of the diff code?YellowBelllyBlackSnake wrote: ↑Fri, 9. Aug 24, 10:27 Comparing it to SprIder 's code, the "replace sel=" part of the code isn't right. It should look something like this.Also if you're only changing a few turrets, make sure that you change all the turrets in the same group, otherwise it likely won't work.Code: Select all
<replace sel="//connection[@name='con_turret_001']/@tags">turret medium mining standard missile hittable combat </replace>
I'll try that and see what happens.
In theory it should append "mining" into "tags", but from testing it out yesterday, it doesn't actually affect anything (turrets are exactly the same as normal), which is why I'm thinking it places "mining" somewhere outside of "tags".apricotslice wrote: ↑Fri, 9. Aug 24, 11:12I think that code replaces the original tags with just mining. Just guessing, but without the combat tag, the ship won't fire to protect itself.Shame it doesn't work, would make combining mods with different weapon tags a lot easier. My guess is that it doesn't appended "mining" into "tag", but instead makes it a child of "connection" or "tag".sprIder wrote: ↑Thu, 8. Aug 24, 19:13 Just adding the tag "mining" seems not to work:Code: Select all
<?xml version="1.0"?> <diff> <add sel="//connection[@name='con_turret_l_001']/@tags"> mining </add> </diff>
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Re: Diff code to add mining to all turrets on a ship?
It's still not working for me.YellowBelllyBlackSnake wrote: ↑Fri, 9. Aug 24, 13:22 Just tried your code and it does work, but only group L2 and M5 has mining turrets. I did find that the format of the names of the large turrets changes slightly after the first two, which is why only group L2 has mining turrets.
This is a recurring theme for me. My code works for other people, but not for me, and it drives me nuts.
Where exactly did you put the file? Just in case I've got it wrong?
-
- Posts: 19
- Joined: Sun, 12. Jan 14, 23:05
Re: Diff code to add mining to all turrets on a ship?
I put it in "X4 Foundations\extensions\MOD-NAME\extensions\ego_dlc_split\assets\units\size_xl"apricotslice wrote: ↑Fri, 9. Aug 24, 14:23 Where exactly did you put the file? Just in case I've got it wrong?
Because the Raptor is a DLC ship, you need to put it into an extensions folder in your mod's folder.
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Re: Diff code to add mining to all turrets on a ship?
YellowBelllyBlackSnake wrote: ↑Fri, 9. Aug 24, 14:53I put it in "X4 Foundations\extensions\MOD-NAME\extensions\ego_dlc_split\assets\units\size_xl"apricotslice wrote: ↑Fri, 9. Aug 24, 14:23 Where exactly did you put the file? Just in case I've got it wrong?
Because the Raptor is a DLC ship, you need to put it into an extensions folder in your mod's folder.

Learn something new every day.
Thanks.
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Re: Diff code to add mining to all turrets on a ship?
Nope still not working.
I created the folders under the split DLC folder, and the diff file in size_xl.
Nothing changed.
What else am I missing, because I must be missing something?
I created the folders under the split DLC folder, and the diff file in size_xl.
Nothing changed.
What else am I missing, because I must be missing something?
-
- Posts: 19
- Joined: Sun, 12. Jan 14, 23:05
Re: Diff code to add mining to all turrets on a ship?
Only thing I can think of is checking that the diff file name is "ship_spl_xl_carrier_01.xml", otherwise I'm really not sure why it isn't working.
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Re: Diff code to add mining to all turrets on a ship?
Wait. What?YellowBelllyBlackSnake wrote: ↑Fri, 9. Aug 24, 14:53 I put it in "X4 Foundations\extensions\MOD-NAME\extensions\ego_dlc_split\assets\units\size_xl"
I didn't read that properly. Extensions within the mod?



Okay, seems to be working now. The mining turrets are showing, although when you save the fitout, it's greyed out as incompatible equipment selected.
I'll try it in game and see if it will actually mine dirt.
Thanks.
Edit: SUCCESS! The 2 turrets are enough to get dirt mining working.
HUGE THANK YOU!!
-
- Posts: 135
- Joined: Sat, 3. Jul 10, 23:23
Re: Diff code to add mining to all turrets on a ship?
Is it still greyed out? Maybe check if you are missing at con_turret_003 the closing " ' " right " after con_turret_003 ".apricotslice wrote: ↑Sat, 10. Aug 24, 13:57 Okay, seems to be working now. The mining turrets are showing, although when you save the fitout, it's greyed out as incompatible equipment selected.
wrong:
Code: Select all
<replace sel="//connection[@name='con_turret_003]/@tags">turret medium mining standard missile hittable combat </replace>
Code: Select all
<replace sel="//connection[@name='con_turret_003']/@tags">turret medium mining standard missile hittable combat </replace>
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Re: Diff code to add mining to all turrets on a ship?
Thanks for that. I'll check it next game play.
The ships are working nicely now, but really crappy at fighting though. Makes me think either miners were dumbed down for defending themselves, or freighter crews are just like that.
Anyway, it works, and that makes a world of difference to my game.
The ships are working nicely now, but really crappy at fighting though. Makes me think either miners were dumbed down for defending themselves, or freighter crews are just like that.
Anyway, it works, and that makes a world of difference to my game.