Skip to content

Commit

Permalink
0.12.0 (#12)
Browse files Browse the repository at this point in the history
 - Updated to use the latest `SirNukes Mod Support APIs` features.
 - Updated German texts. (Thank you @LeLeon)
 - Ships that participate in a successful harass operation will gain experience.

Co-authored-by: LeLeon <[email protected]>
  • Loading branch information
AlbertoRota and LeLeon authored May 22, 2020
1 parent 8c1cb17 commit 8f8ff01
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 71 deletions.
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,31 @@ Your allies will no longer protect your enemies from you!
- https://text2voice.org, https://twistedwave.com/online, and https://voicechanger.io/ -> All of them used to create the custom dialog lines.

## Changelog
### 0.12.0
- Updated to use the latest `SirNukes Mod Support APIs` features.
- Updated German texts. (Thank you @LeLeon)
- Ships that participate in a successful harass operation will gain experience.
### 0.11.0
- Created new default order `Corsair`, ships/fleets with this behavior will smartly harass selected enemy targets
- Improved Harass operation logic
- Improved debug logging
- Disabled `combat_reputation_hit` and `harass_reputation_hit`, I need to find a better way of handling it
- Stations will not allow a fleeing ship to dock if the attacker is allied to them
- Separated changes into `Major changes` and `Minor changes` to increase readability
- Created new default order `Corsair`, ships/fleets with this behavior will smartly harass selected enemy targets.
- Improved Harass operation logic.
- Improved debug logging.
- Disabled `combat_reputation_hit` and `harass_reputation_hit`, I need to find a better way of handling it.
- Stations will not allow a fleeing ship to dock if the attacker is allied to them.
- Separated changes into `Major changes` and `Minor changes` to increase readability.
### 0.10.0
- Subordinates of the player ship will smartly participate in the "Harass operation"
- Subordinates of the player ship will smartly participate in the "Harass operation".
### 0.9.0
- Improved logic to avoid having boarding pods orbiting ship when using marines to claim a ship
- Improved logic to avoid having boarding pods orbiting ship when using marines to claim a ship.
### 0.8.0
- When using marines to claim a ship, the boarding pod will use the travel drive
- Improved logic to avoid having boarding pods orbiting ship when using marines to claim a ship
- When using marines to claim a ship, the boarding pod will use the travel drive.
- Improved logic to avoid having boarding pods orbiting ship when using marines to claim a ship.
### 0.7.0
- Removed boarding pods orbiting ship when using marines to claim a ship
- Added German translation
- Added French translation
- Removed boarding pods orbiting ship when using marines to claim a ship.
- Added German translation.
- Added French translation.
### 0.6.0
- Added custom dialog lines during harass operation, now you know that you are threatening them.
- Minor fixes
- Minor fixes.
### 0.5.0
- Improved the `Harass` command vs capital ships, now it will only soften them.
- Added distance checks to the `Harass` command, now you really need to stick on the target.
Expand All @@ -97,7 +101,7 @@ Your allies will no longer protect your enemies from you!
- Externalized hard-coded texts to I18N files (English and Spanish).
### 0.3.0
- Removed `Surrender!` dialog, replaced it by a more streamlined `RightClick -> Harass`.
- Added dependency to "SirNukes Mod Support APIs"
- Added dependency to "SirNukes Mod Support APIs".
### 0.2.0
- Forcing a pilot to bail out of their ship will negatively impact your relations with his/her faction.
### 0.1.0
Expand Down
2 changes: 1 addition & 1 deletion content.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<content id="ws_2056100433" name="Better piracy" description="X4 Foundations mod to improve piracy." version="1100" save="0" author="alberto-rota" date="2020-05-16" sync="false" lastupdate="1589601749">
<content id="ws_2056100433" name="Better piracy" description="X4 Foundations mod to improve piracy." version="1200" save="0" author="alberto-rota" date="2020-05-22" sync="false" lastupdate="1590156143">
<langugage language="7" description="X4 Foundations mod to improve piracy."/>
<langugage language="33" description="X4 Foundations mod to improve piracy."/>
<langugage language="34" description="Mod para X4 Foundations que mejora la piratería."/>
Expand Down
16 changes: 16 additions & 0 deletions libraries/experiences.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<experiences>
<experience id="BETTER_PIRACY_HARASS">
<skill ref="piloting">
<individual base="1.0" falloff="0.88" limit="25"/>
</skill>
<skill ref="engineering">
<individual base="1.0" falloff="0.84" limit="25"/>
<group base="1.0" falloff="0.88" limit="25"/>
</skill>
<skill ref="morale">
<individual base="1.0" falloff="0.92" limit="25"/>
<group base="1.0" falloff="0.88" limit="25"/>
</skill>
</experience>
</experiences>
24 changes: 5 additions & 19 deletions md/betterpiracy_config.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<mdscript name="Betterpiracy_config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://x4libonline.ddns.net/libraries/md.xsd">
<cues>
<!-- TODO: Replace "attepmps" by "attemps". -->

<cue name="Config">
<actions>
<include_actions ref="Reset_Config"/>
</actions>
<!-- TODO: Investigate reset
<cues>
<cue name="Reset_On_Lua_Reload" instantiate="true">
<conditions>
<event_cue_signalled cue="md.Simple_Menu_API.Reloaded"/>
</conditions>
<actions>
<include_actions ref="Reset_Config"/>
</actions>
</cue>
</cues>
-->
</cue>
<library name="Reset_Config">
<actions>
Expand All @@ -27,9 +13,9 @@
exact="table[
$harass_shield_threshold = null,
$early_harass_hull_threshold = null,
$harass_bail_attepmps_before_mid = null,
$harass_bail_attemps_before_mid = null,
$mid_harass_hull_threshold = null,
$harass_bail_attepmps_before_late = null,
$harass_bail_attemps_before_late = null,
$late_harass_hull_threshold = null,
$keep_pressure_timer = null,
$keep_pressure_max_distance_sm = null,
Expand Down Expand Up @@ -87,7 +73,7 @@
cue = "md.Simple_Menu_Options.Register_Option"
param = "table[
$category = {61537, 5150},
$id = '$harass_bail_attepmps_before_mid',
$id = '$harass_bail_attemps_before_mid',
$name = {61537, 5155},
$mouseover = {61537, 5156},
$type = 'slidercell',
Expand All @@ -113,7 +99,7 @@
cue = "md.Simple_Menu_Options.Register_Option"
param = "table[
$category = {61537, 5150},
$id = '$harass_bail_attepmps_before_late',
$id = '$harass_bail_attemps_before_late',
$name = {61537, 5159},
$mouseover = {61537, 5160},
$type = 'slidercell',
Expand Down Expand Up @@ -333,7 +319,7 @@
<event_cue_signalled />
</conditions>
<actions>
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_config --- Changing %s from %s to %s.'.[player.age, event.param.$id, Config.$Config.{event.param.$id}, event.param.$value]" />
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_config --- Changing %s from %s to %s.'.[player.age, event.param.$id, Config.$Config.{event.param.$id}, event.param.$value]" />
<set_value
name="Config.$Config.{event.param.$id}"
exact="event.param.$value"
Expand Down
65 changes: 38 additions & 27 deletions md/betterpiracy_harass.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<mdscript name="Betterpiracy_harass" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://x4libonline.ddns.net/libraries/md.xsd">
<cues>
<!-- TODO: Replace "attepmps" by "attemps". -->

<!-- Register the custom interaction menu entry. -->
<cue name="Reset_On_Reload" instantiate="true">
<!-- Add the custom interaction menu entry. -->
<cue name="Add_Interact_Actions" instantiate="true">
<conditions>
<event_cue_signalled cue="md.Interact_Menu_API.Reloaded"/>
<event_cue_signalled cue="md.Interact_Menu_API.Get_Actions" />
</conditions>
<actions>
<signal_cue_instantly
cue="md.Interact_Menu_API.Register_Action"
param = "table[
$id = 'betterpiracy_harass',
$section = 'interaction',
$name = {61537, 5100},
$callback = Harass_OperationCreated,
$enabled_conditions = ['class_ship'],
$disabled_conditions = ['~show_PlayerInteractions', '~is_playerowned'],
]"
/>
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_harass --- Registered custom `Harass` command as: %s.'.[player.age, {61537, 5100}]" />
<set_value name="$target" exact="event.param.$object"/>
<do_if value="$target.isclass.ship and $target.pilot.exists and $target.isoperational and $target.iscapturable and not $target.isplayerowned and not $target.isunit and not $target.islasertower">
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_harass --- Added custom `Harass` interact action as: %s.'.[player.age, {61537, 5050}]" />
<signal_cue_instantly
cue="md.Interact_Menu_API.Add_Action"
param = "table[
$id = 'betterpiracy_harass',
$section = 'interaction',
$text = {61537, 5050},
$mouseover = {61537, 5051},
$icon = 'order_harass',
$mouseover_icon = 'order_harass',
$callback = Harass_OperationCreated,
]"/>
</do_if>
</actions>
</cue>

Expand Down Expand Up @@ -50,7 +51,7 @@
<set_value name="$Config" exact="md.Betterpiracy_config.Config.$Config"/>
<set_value name="$CurrentPhase" exact="'Harass_OperationCreated'"/>
<set_value name="$Pressure" exact="0"/>
<set_value name="$BailAttepmps" exact="0"/>
<set_value name="$BailAttemps" exact="0"/>

<do_if value="$Target.iscapitalship">
<set_value name="$MaxDistance" exact="($Config.{'$keep_pressure_max_distance_lxl'})km"/>
Expand Down Expand Up @@ -112,16 +113,16 @@
</library>
<library name="Harass_CheckHull">
<actions>
<do_if value="$BailAttepmps ge $Config.{'$harass_bail_attepmps_before_late'} and $Target.hullpercentage ge $Config.{'$late_harass_hull_threshold'}">
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_harass --- %s `Harass_CheckHull` library check failed, rolling back to damageHull phase: $Target.hullpercentage = %s, $BailAttepmps = %s, $Config.{`$harass_bail_attepmps_before_mid`} = %s, $Config.{`$harass_bail_attepmps_before_late`} = %s, $Config.{`$early_harass_hull_threshold`} = %s, $Config.{`$mid_harass_hull_threshold`} = %s, $Config.{`$late_harass_hull_threshold`} = %s'.[player.age, $MissionCue, $Target.hullpercentage, $BailAttepmps, $Config.{'$harass_bail_attepmps_before_mid'}, $Config.{'$harass_bail_attepmps_before_late'}, $Config.{'$early_harass_hull_threshold'}, $Config.{'$mid_harass_hull_threshold'}, $Config.{'$late_harass_hull_threshold'}]" />
<do_if value="$BailAttemps ge $Config.{'$harass_bail_attemps_before_late'} and $Target.hullpercentage ge $Config.{'$late_harass_hull_threshold'}">
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_harass --- %s `Harass_CheckHull` library check failed, rolling back to damageHull phase: $Target.hullpercentage = %s, $BailAttemps = %s, $Config.{`$harass_bail_attemps_before_mid`} = %s, $Config.{`$harass_bail_attemps_before_late`} = %s, $Config.{`$early_harass_hull_threshold`} = %s, $Config.{`$mid_harass_hull_threshold`} = %s, $Config.{`$late_harass_hull_threshold`} = %s'.[player.age, $MissionCue, $Target.hullpercentage, $BailAttemps, $Config.{'$harass_bail_attemps_before_mid'}, $Config.{'$harass_bail_attemps_before_late'}, $Config.{'$early_harass_hull_threshold'}, $Config.{'$mid_harass_hull_threshold'}, $Config.{'$late_harass_hull_threshold'}]" />
<signal_cue_instantly cue="Harass_ChangePhase" param="'damageHull'"/>
</do_if>
<do_elseif value="$BailAttepmps ge $Config.{'$harass_bail_attepmps_before_mid'} and $Target.hullpercentage ge $Config.{'$mid_harass_hull_threshold'}">
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_harass --- %s `Harass_CheckHull` library check failed, rolling back to damageHull phase: $Target.hullpercentage = %s, $BailAttepmps = %s, $Config.{`$harass_bail_attepmps_before_mid`} = %s, $Config.{`$harass_bail_attepmps_before_late`} = %s, $Config.{`$early_harass_hull_threshold`} = %s, $Config.{`$mid_harass_hull_threshold`} = %s, $Config.{`$late_harass_hull_threshold`} = %s'.[player.age, $MissionCue, $Target.hullpercentage, $BailAttepmps, $Config.{'$harass_bail_attepmps_before_mid'}, $Config.{'$harass_bail_attepmps_before_late'}, $Config.{'$early_harass_hull_threshold'}, $Config.{'$mid_harass_hull_threshold'}, $Config.{'$late_harass_hull_threshold'}]" />
<do_elseif value="$BailAttemps ge $Config.{'$harass_bail_attemps_before_mid'} and $Target.hullpercentage ge $Config.{'$mid_harass_hull_threshold'}">
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_harass --- %s `Harass_CheckHull` library check failed, rolling back to damageHull phase: $Target.hullpercentage = %s, $BailAttemps = %s, $Config.{`$harass_bail_attemps_before_mid`} = %s, $Config.{`$harass_bail_attemps_before_late`} = %s, $Config.{`$early_harass_hull_threshold`} = %s, $Config.{`$mid_harass_hull_threshold`} = %s, $Config.{`$late_harass_hull_threshold`} = %s'.[player.age, $MissionCue, $Target.hullpercentage, $BailAttemps, $Config.{'$harass_bail_attemps_before_mid'}, $Config.{'$harass_bail_attemps_before_late'}, $Config.{'$early_harass_hull_threshold'}, $Config.{'$mid_harass_hull_threshold'}, $Config.{'$late_harass_hull_threshold'}]" />
<signal_cue_instantly cue="Harass_ChangePhase" param="'damageHull'"/>
</do_elseif>
<do_elseif value="$Target.hullpercentage ge $Config.{'$early_harass_hull_threshold'}">
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_harass --- %s `Harass_CheckHull` library check failed, rolling back to damageHull phase: $Target.hullpercentage = %s, $BailAttepmps = %s, $Config.{`$harass_bail_attepmps_before_mid`} = %s, $Config.{`$harass_bail_attepmps_before_late`} = %s, $Config.{`$early_harass_hull_threshold`} = %s, $Config.{`$mid_harass_hull_threshold`} = %s, $Config.{`$late_harass_hull_threshold`} = %s'.[player.age, $MissionCue, $Target.hullpercentage, $BailAttepmps, $Config.{'$harass_bail_attepmps_before_mid'}, $Config.{'$harass_bail_attepmps_before_late'}, $Config.{'$early_harass_hull_threshold'}, $Config.{'$mid_harass_hull_threshold'}, $Config.{'$late_harass_hull_threshold'}]" />
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_harass --- %s `Harass_CheckHull` library check failed, rolling back to damageHull phase: $Target.hullpercentage = %s, $BailAttemps = %s, $Config.{`$harass_bail_attemps_before_mid`} = %s, $Config.{`$harass_bail_attemps_before_late`} = %s, $Config.{`$early_harass_hull_threshold`} = %s, $Config.{`$mid_harass_hull_threshold`} = %s, $Config.{`$late_harass_hull_threshold`} = %s'.[player.age, $MissionCue, $Target.hullpercentage, $BailAttemps, $Config.{'$harass_bail_attemps_before_mid'}, $Config.{'$harass_bail_attemps_before_late'}, $Config.{'$early_harass_hull_threshold'}, $Config.{'$mid_harass_hull_threshold'}, $Config.{'$late_harass_hull_threshold'}]" />
<signal_cue_instantly cue="Harass_ChangePhase" param="'damageHull'"/>
</do_elseif>
</actions>
Expand Down Expand Up @@ -282,10 +283,10 @@
<include_actions ref="Harass_CheckTarget"/>
<include_actions ref="Harass_CheckShields"/>

<do_if value="$BailAttepmps ge $Config.{'$harass_bail_attepmps_before_late'}">
<do_if value="$BailAttemps ge $Config.{'$harass_bail_attemps_before_late'}">
<set_value name="$MissedHullThreshold" exact="100 - $Config.{'$late_harass_hull_threshold'}"/>
</do_if>
<do_elseif value="$BailAttepmps ge $Config.{'$harass_bail_attepmps_before_mid'}">
<do_elseif value="$BailAttemps ge $Config.{'$harass_bail_attemps_before_mid'}">
<set_value name="$MissedHullThreshold" exact="100 - $Config.{'$mid_harass_hull_threshold'}"/>
</do_elseif>
<do_else>
Expand Down Expand Up @@ -378,11 +379,11 @@
<do_if value="$CurrentTimeLeft le 0">
<set_value name="$NextBailCheck" exact="player.age + ($Config.{'$keep_pressure_timer'})s"/>
<set_value name="$Pressure" operation="add"/>
<set_value name="$BailAttepmps" operation="add"/>
<set_value name="$BailAttemps" operation="add"/>
<do_if value="$HasMission">
<speak actor="player.computer" page="61538" line="[4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409].random" priority="90"/>
</do_if>
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_harass --- %s --- `Harass_WaitForSurrender_Check` passed, triggering bail attemp: $NextBailCheck = %s, $Pressure = %s, $BailAttepmps = %s.'.[player.age, $MissionCue, $NextBailCheck, $Pressure, $BailAttepmps]" />
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_harass --- %s --- `Harass_WaitForSurrender_Check` passed, triggering bail attemp: $NextBailCheck = %s, $Pressure = %s, $BailAttemps = %s.'.[player.age, $MissionCue, $NextBailCheck, $Pressure, $BailAttemps]" />
<signal_cue_instantly cue="md.Betterpiracy_custom_bail_logic.PlayerOwnedShipHarass" param="$MissionCue"/>
</do_if>
</actions>
Expand All @@ -398,6 +399,16 @@
<set_value name="$CurrentPhase" exact="this"/>
<debug_to_file name="'BetterPiracy'" text="'%s --- Betterpiracy_harass --- %s calling `Harass_Claim` cue.'.[player.age, $MissionCue]" />
<signal_objects object="$Target" param="$MissionCue" param2="'harass__end'"/>
<!-- Give experience to involved ships -->
<do_if value="not $HasMission">
<apply_experience entity="$MainHarasser.pilot" experience="'BETTER_PIRACY_HARASS'" factor="1.0"/>
<apply_experience object="$MainHarasser" experience="'BETTER_PIRACY_HARASS'" role="entityrole.service" factor="1.0"/>
</do_if>
<do_all exact="$Harassers.count" counter="$i">
<apply_experience entity="$Harassers.{$i}.pilot" experience="'BETTER_PIRACY_HARASS'" factor="0.8"/>
<apply_experience object="$Harassers.{$i}" experience="'BETTER_PIRACY_HARASS'" role="entityrole.service" factor="0.8"/>
</do_all>
<!-- Move to the next phase or finish -->
<do_if value="$HasMission">
<do_if value="$Target.iscapitalship">
<set_objective cue="$MissionCue" step="$MissionStep_ClaimShip" action="objective.board" text="{61537, 5110}" object="$Target" silent="true"/>
Expand Down
18 changes: 9 additions & 9 deletions t/0001-l049.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<language id="49">
<page id="61537" title="Better piracy texts" descr="0" voice="no">
<!-- Harass order related texts -->
<t id="5050">Harass</t>
<t id="5051">Directly harass a target or support a harass operation.</t>
<t id="5052">Corsair</t>
<t id="5053">Command a pirate gang to harass ships in sector.</t>
<t id="5054">Target S sized ships: </t>
<t id="5055">Target M sized ships: </t>
<t id="5056">Target combat ships: </t>
<t id="5057">Target trader ships: </t>
<t id="5058">Target mining ships: </t>
<t id="5050">Schikanieren</t>
<t id="5051">Schikaniert ein Ziel direkt oder unterstützt eine Schikaneoperation</t>
<t id="5052">Kaperflotte</t>
<t id="5053">Bildet eine Kaperflotte, um Schiffe im Sektor zu schikanieren und zu übernehmen.</t>
<t id="5054">Kapere Schiffsgröße S </t>
<t id="5055">Kapere Schiffsgröße M</t>
<t id="5056">Kapere Kampfschiffe</t>
<t id="5057">Kapere Handelsschiffe</t>
<t id="5058">Kapere Schürferschiffe</t>
<!-- Harass mission related texts -->
<t id="5100">Schikanieren</t>
<t id="5101">(Harass mission title)Gegnercrew schikanieren </t>
Expand Down

0 comments on commit 8f8ff01

Please sign in to comment.