Rinart73 Posted July 27, 2018 Share Posted July 27, 2018 [serverside] [Optionally clientside] [0.17.1 - 0.18.3] GitHub Many people find it annoying that player/alliance AI ships in aggressive mode will attack enemy civil ships thus lowering your reputation. Well it seems that I found a way to deal with this problem through use of not very known part of the API and some workarounds. My solution also seems to be performance friendly. As of version 1.1.0 you can also toggle aggression back on if you have this mod installed on both sides. Starting from version 1.2.0 you need to install Mod Helper - Craft Orders in order for this mod to work. Note: I assume that on a low-spec servers there is a tiny chance that AI ship will attack civil ships that were created in current sector (not warped into it) for a split second. This is due to the fact that there is no way to check if new ship is civil immediately after it was created. Although I tested the mod on low-spec notebook and everything was fine. Installation [*]Optionally install i18n - Internationalization if you want to have this mod translated in your language (version 1.2.0+) [*]Install Mod Helper - Craft Orders (version 1.2.0+) [*]Unpack mod archive into "Avorion" folder (next to the "data" folder) [*]Add following line in the end of "Avorion\data\scripts\entity\craftorders.lua" file (after Mod Helper line): if not pcall(require, "mods.NoCivilFire.scripts.entity.craftorders") then print("[NoCivilFire][ERROR]: failed to extend craftorders.lua!") end Uninstallation Mod is safe to uninstall. Known issues Doesn't work on turrets in auto/defend mode. Just because API doesn't work on them. I posted this as a game bug Compatibility Mod overrides following functions: CraftOrders.initialize() - server CraftOrders.setAIAction(action, index, position) - server CraftOrders.secure() - server CraftOrders.restore(dataIn) - server CraftOrders.initUI() - client, prior to version 1.2.0 CraftOrders.onAttackEnemiesButtonPressed() - server, prior to version 1.1.0 Implements functions: CraftOrders.updateServer() - server Changelog 1.2.1 Fixed: Ships that belong to disbanded Alliance triggered an error Fixed: Minor 'callingPlayer' check error 1.2.0 Added: Localization support - you'll need to install i18n - Internationalization (optional) Added: API - function "CraftOrders.noCivilFire_setCivilianShooting" and variable "CraftOrders.noCivilFire_civilianShooting" Changed: Instead of overriding 'initUI' function mod now uses ModHelper_CraftOrders, which will allow other mods that use it to work together. Fixed: Added permission check when toggling civilian fire on/off Fixed: Mod now works when ship is in patrol mode too 1.1.0 Added: If installed on clientside too (optional) mod adds a checkbox which allows to toggle aggression towards civilian ships on and off (off by default) Removed: Mod no longer overrides 'CraftOrders.onAttackEnemiesButtonPressed()' function 1.0.0 Initial release API Variables CraftOrders.noCivilFire_civilianShooting - true if civilian fire is toggled on. false otherwise. Note: Don't change this variable, use function "CraftOrders.noCivilFire_setCivilianShooting" Functions function CraftOrders.noCivilFire_setCivilianShooting (bool on) - Toggles civilian fire on/off.Returns: true on success. False if it was called on client side and player doesn't have permissions to perform this action. False on server if it's an NPC ship.Note: If you calling this function on server side, always call it though "invokeFunction": Entity():invokeFunction("craftorders.lua", "noCivilFire_setCivilianShooting", on) Help to Translate Currently supported languages: English, Russian. You can help to translate this mod: "Don't attack civilians" Module for Complex Craft Orders As of mod version 1.2.0, there is also an optional module, that allows settings from No Civil Fire to affect Target functions of Complex Craft Orders basic module. Installation: [*]You still need to install the main mod [*]Unpack module archive into folder "mods\ComplexCraftOrders\modules" [*]Add ' "nocivilfire", ' in the file "mods\ComplexCraftOrders\config\Config.lua" after ' "basic", '. So you will have this as a result: config.modules = { "basic", "nocivilfire", -- place your module folder into "mods/ComplexCraftOrders/modules" and add your module name in this table } NoCivilFire-1.1.0.zip NoCivilFire-1.2.0_0.17.1-0.18.2.zip NoCivilFire-module-1.2.0-1.zip NoCivilFire-1.2.1_0.17.1-0.18.2.zip [*]Remove "NoCivilFire" folder from the "mods" folder [*]Remove the line from "Avorion\data\scripts\entity\craftorders.lua" Link to comment Share on other sites More sharing options...
Rinart73 Posted July 27, 2018 Author Share Posted July 27, 2018 Update - 1.1.0 Added: If installed on clientside too (optional) mod adds a checkbox which allows to toggle aggression towards civilian ships on and off (off by default) Removed: Mod no longer overrides 'CraftOrders.onAttackEnemiesButtonPressed()' function Link to comment Share on other sites More sharing options...
Devious Posted August 2, 2018 Share Posted August 2, 2018 Thank you for getting the toggle in, one step ahead :) Link to comment Share on other sites More sharing options...
Rinart73 Posted August 2, 2018 Author Share Posted August 2, 2018 Actually I wasn't going to add toggle initially as I wanted to it simplier. But "Ismael" on Discord immediately asked me to :) Link to comment Share on other sites More sharing options...
Rinart73 Posted August 5, 2018 Author Share Posted August 5, 2018 1.2.0 Added: Localization support - you'll need to install i18n - Internationalization (optional) Added: API - function "CraftOrders.noCivilFire_setCivilianShooting" and variable "CraftOrders.noCivilFire_civilianShooting" Changed: Instead of overriding 'initUI' function mod now uses ModHelper_CraftOrders, which will allow other mods that use it to work together. Fixed: Added permission check when toggling civilian fire on/off Fixed: Mod now works when ship is in patrol mode too There is now also a module for Complex Craft Orders that will allow settings from this mod to affect 'basic' module enemy Target functions! Link to comment Share on other sites More sharing options...
Rinart73 Posted August 8, 2018 Author Share Posted August 8, 2018 1.2.1 - hotfix Fixed: Ships that belong to disbanded Alliance triggered an error Fixed: Minor 'callingPlayer' check error You will want to update Mod Helper - Craft Orders too, because it got an important hotfix as well. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now