X4: Foundations
0 of 0

File information

Last updated

Original upload

Created by

metame

Uploaded by

apoptosist

Virus scan

Safe to use

Tags for this mod

About this mod

Removes the extremely dense friend/foe mines in Silent Witness XII, with XSLT that can be easily adapted to other uses.

Permissions and credits
Here is the very simple XSLT used to generate this mod. With some tweaks, much more can be done. I commented out the generation of a gamestart, where most of the good stuff happens:
<!-- Run Examples:
     transform -xsl:"C:\Games\Steam\steamapps\common\X4 Foundations\region_ff_delete.xslt" -it:main inF="D:/Games/Steam/steamapps/common/X4 Foundations/" modID="region_ff_delete" outF="D:/X4_out/" root="X4_extracted/" universe="xu_ep2_universe" region="region_cluster_45_sector_001"
-->
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" />
    <xsl:strip-space elements="*" />
   
    <xsl:param name="inF" select="inF"/>
    <xsl:param name="modID" select="modID"/>
    <xsl:param name="outF" select="outF"/>
    <!-- root should end with / -->
    <xsl:param name="root" select="root"/>
    <xsl:param name="universe" select="universe"/>
    <xsl:variable name="otherExtensionFolder" select="replace($root,'^[^/]*/','')"/>

    <xsl:param name="region" select="region"/>
   
    <xsl:variable name="sourceString" select="concat($inF,$root)"/>
    <xsl:variable name="outputString" select="concat($outF,$modID,'/')"/>
    <xsl:variable name="sourceURI" select="concat('file:///',encode-for-uri(replace($sourceString,'\\','/')))"/>
    <xsl:variable name="outputURI" select="concat('file:///',encode-for-uri(replace($outputString,'\\','/')))"/>
   
    <xsl:template name="main">
        <xsl:variable name="clusters">
            <xsl:choose>
                <xsl:when test="starts-with($universe,'demo')">
                    <xsl:value-of select="concat('demo_','clusters')"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="concat(replace(replace($root,'^[^/]*/',''),'^[^/]*/ego_(.*)/','$1_'),'clusters')"/>    
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
       
        <xsl:result-document href="{concat($outputURI,'content.xml')}">
            <content id="{$modID}"
                     name="{$modID}" description="" author="{concat('metame','''','s Generator')}"
                     date="{format-date(current-date(),'[Y0001]-[M01]-[D01]')}"
                     version="100" save="0">
            </content>
        </xsl:result-document>
       
        <xsl:result-document href="{concat($outputURI,'libraries/region_definitions.xml')}">
            <diff>
                <remove sel="/regions/region[@name='{$region}']/fields/object[@ref='weapon_gen_mine_03_macro']" />
            </diff>
        </xsl:result-document>
<!--        
        <xsl:result-document href="{concat($outputURI,'libraries/gamestarts.xml')}">
            <diff>
                <add sel="/gamestarts">
                    <xsl:variable name="thisSector" select="collection(concat($sourceURI,'maps/',$universe,'?recurse=no;select=',$clusters,'.xml'))/macros/macro[connections/connection/macro/properties/region[@ref=$region]]/connections/connection[@ref='sectors']/macro/@ref"/>
                    <gamestart id="{lower-case(concat('cstart_',$thisSector))}" name="{lower-case(concat('cstart_',$thisSector))}" description="" image="gamestart_5" group="1">
                        <location galaxy="{concat($universe,'_macro')}" sector="{lower-case($thisSector)}"/>
                        <player macro="character_player_scenario_advanced_argon_macro" female="false" money="5000" name="Ren">
                            <ship macro="ship_ter_s_scout_01_a_macro">
                                <loadout>
                                    <macros>
                                        <engine macro="engine_ter_s_combat_01_mk3_macro" path="../con_engine_01" />
                                        <shield macro="shield_ter_s_standard_01_mk3_macro" path="../con_shield_01" />
                                    </macros>
                                    <ammunition>
                                        <ammunition macro="env_deco_nav_beacon_t1_macro" exact="5" />
                                        <ammunition macro="eq_arg_satellite_01_macro" exact="5" />
                                        <ammunition macro="eq_arg_resourceprobe_01_macro" exact="5" />
                                    </ammunition>
                                    <software>
                                        <software ware="software_flightassistmk1" />
                                        <software ware="software_scannerlongrangemk1" />
                                        <software ware="software_scannerobjectmk1" />
                                        <software ware="software_targetmk1" />
                                        <software ware="software_dockmk2" />
                                    </software>
                                    <virtualmacros>
                                        <thruster macro="thruster_gen_s_allround_01_mk3_macro" />
                                    </virtualmacros>
                                </loadout>
                            </ship>
                            <inventory>
                                <ware ware="weapon_gen_spacesuit_repairlaser_01_mk1" amount="1" />
                                <ware ware="software_scannerobjectmk3" amount="1" />
                                <ware ware="inv_timewarp" amount="1" />
                            </inventory>
                            <blueprints>
                                <ware ware="clothingmod_0001" />
                                <ware ware="clothingmod_0002" />
                                <ware ware="paintmod_0006" />
                                <ware ware="paintmod_0048" />
                                <ware ware="paintmod_0049" />
                                <ware ware="paintmod_0050" />
                            </blueprints>
                            <research>
                                <ware ware="research_radioreceiver" />
                                <ware ware="research_sensorbooster" />
                                <ware ware="research_tradeinterface" />
                            </research>
                            <encyclopedia>
                                <entry type="warebasket" ref="research_gamestart_common" />
                            </encyclopedia>
                            <theme paint="painttheme_player_01" />
                        </player>
                        <universe ventures="false" visitors="false" />
                    </gamestart>
                </add>
            </diff>
        </xsl:result-document>
-->
    </xsl:template>
   
</xsl:stylesheet>