Author Topic: [MOD-Plugin] Loot Collection for Carrier Command  (Read 6549 times)

Tigron

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    16
    • View Profile
on: October 02, 2018, 04:29:21 PM
can we get a fix for the newest update to the carrier commands. I added the lines but in the settings of the command box all I have is attack settings, it no longer scroll down to the other commands.



Naevaris

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    1
    • View Profile
on: October 10, 2018, 09:20:25 PM
After some editing I managed to make the interface work by making the configuration UI a separate file and storing it in the CCBasicCommands folder, to bring it in line with the rest of the commands.

specifically, the config part of lootCommand.lua needs to be stored in a lootCommand_config.lua (use one of the other commands for reference.) placing the two files in the CCBasicCommands folder allows them to be loaded with the other commands as per CarrierCommander.lua:

" local c = require(cc.commands[prefix].path.."_config") "

Edit:

After some testing it appears as though clicking the button does not activate the loot script properly. Since I'm not great at programming it seems I will have to wait for an official update to this mod.

« Last Edit: October 10, 2018, 09:49:06 PM by Naevaris »



Engine

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    4
    • View Profile
on: October 21, 2018, 11:43:41 PM
Updated this plugin for CC v1.9.0 ex.  Disclaimer: I'm not a programmer, so the code is rather crappy.  I had to rewrite most of the plugin.
I added a new feature to it that tracks the number of loot items remaining.
Install the two files under "Avorion\mods\CCBasicCommands\scripts\entity\ai"
Add the the following lines to lists.lua and CarrierCommanderConfig.lua


Lists.lua
list.actionTostringMap[7] = "Collecting Loot, %i items remaining"
list.actionToColorMap[7] = ColorRGB(0.1, 0.8, 0.1)
Spoiler: show
Code: [Select]
list.actionTostringMap = {}
setmetatable(list.actionTostringMap,{
  __index = function(t,k) return "Invalid order received" end    --fallbackfunction, getting called when indexed with an invalid key
})
    list.actionTostringMap["noHangar"] = "No Hangar found!"
    list.actionTostringMap["noFighterController"] = "No FighterController found!"
    list.actionTostringMap["targetButNoFighter"] = "Found a target, but no suitable fighters."
    list.actionTostringMap["idle"] = "Idle and waiting for targets."
    list.actionTostringMap[-1] = "Not doing anything."
    list.actionTostringMap[FighterOrders.Attack] = "Attacking ship %s"
    list.actionTostringMap[FighterOrders.Defend] = "Defending ship %s"
    list.actionTostringMap[FighterOrders.Return] = "Waiting for %i Fighter(s) in %i Squad(s) to dock at %s"
    list.actionTostringMap[FighterOrders.FlyToLocation] = "flying to location."
    --list.actionTostringMap[4] = nil                       reserved for new vanilla command
    list.actionTostringMap[5] = "Mining asteroids."
    list.actionTostringMap[6] = "Salvaging wrecks."
list.actionTostringMap[7] = "Collecting Loot, %i items remaining"

list.actionToColorMap = {}
setmetatable(list.actionToColorMap,{
  __index = function(t,k) return ColorRGB(0.9, 0.1, 0.1) end    --fallbackfunction, getting called when indexed with an invalid key
})
    list.actionToColorMap["noHangar"] = ColorRGB(0.9, 0.1, 0.1)
    list.actionToColorMap["noFighterController"] = ColorRGB(0.9, 0.1, 0.1)
    list.actionToColorMap["targetButNoFighter"] = ColorRGB(0.9, 0.1, 0.1)
    list.actionToColorMap["idle"] = ColorRGB(0.3, 0.3, 0.9)
    list.actionToColorMap[-1] = ColorRGB(0.3, 0.3, 0.3)
    list.actionToColorMap[FighterOrders.Attack] = ColorRGB(0.1, 0.8, 0.1)
    list.actionToColorMap[FighterOrders.Defend] = ColorRGB(0.3, 0.3, 0.3)
    list.actionToColorMap[FighterOrders.Return] = ColorRGB(0.5, 0.5, 0.0)
    list.actionToColorMap[FighterOrders.FlyToLocation] = ColorRGB(0.0, 0.5, 0.5)
    --list.actionToColorMap[4] = nil                       reserved for new vanilla command
    list.actionToColorMap[5] = ColorRGB(0.1, 0.8, 0.1)
    list.actionToColorMap[6] = ColorRGB(0.1, 0.8, 0.1)
list.actionToColorMap[7] = ColorRGB(0.1, 0.8, 0.1)
    list.tooltipadditions = {}

return list


CarrierCommanderConfig.lua
loot = {name="Loot Command", path = "mods/CCBasicCommands/scripts/entity/ai/lootCommand"},
Spoiler: show
Code: [Select]
local Config = {}

Config.Author = "Nexus, Dirtyredz, Hammelpilaw, Maxx4u, Laserzwei"
Config.ModName = "CarrierCommander"
Config.version = {
    major=1, minor=9, patch = 0,
    string = function()
        return  Config.version.major .. '.' ..
                Config.version.minor .. '.' ..
                Config.version.patch
    end
}



--new commands go here, <namespcae used by the script> = {name = <button text>, <path> = relative path from the /mods/-folder to the command, without .lua ending }
Config.carrierScripts = {
    dockAll = {name="Dock all Fighters", path = "mods/CarrierCommander/scripts/entity/ai/dockAllFighters"},
    salvage = {name="Salvage Command", path = "mods/CCBasicCommands/scripts/entity/ai/salvageCommand"},
    mine = {name="Mine Command", path = "mods/CCBasicCommands/scripts/entity/ai/mineCommand"},
    attack = {name="Attack Command", path = "mods/CCBasicCommands/scripts/entity/ai/aggressiveCommand"},
loot = {name="Loot Command", path = "mods/CCBasicCommands/scripts/entity/ai/lootCommand"},
repair = {name="Repair Command", path = "mods/CCBasicCommands/scripts/entity/ai/repairCommand"},
    --lootCommand = {name="Loot Command", path = "mods/CCLootPlugin/scripts/entity/ai/lootCommand"}
}

Config.forceUnsupervisedTargeting = false   -- forces the "Unsupervised targeting"- setting for attacking fighters. Default: false

Config.basePriorities = {
    ship = 20,
    guardian = 15,
    station = 10,
    fighter = 5,
}
Config.additionalPriorities = { --Only for modded additions. Modders: When creating a new Boss then use Entity():setValue("customBoss", someValidValue), to mark it. The Attack script will then activley search for those marked enemies and assign the priority set in the config

    --customBoss = 25
}

return Config

« Last Edit: October 21, 2018, 11:45:25 PM by Engine »



Bocephus666

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    4
    • View Profile
on: February 24, 2019, 03:55:11 PM
I just stumbled across this plugin.  Does this still work with the current release?



maraudir

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    4
    • View Profile
on: July 18, 2019, 02:21:51 AM
Bump on Bocephus666 question.



Laserzwei

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    397
    • View Profile
on: July 18, 2019, 03:53:58 PM
I just stumbled across this plugin.  Does this still work with the current release?
Bump on Bocephus666 question.
No
My Mod Collection
My Discord     screw google captcha
My Github
Questions?
> PM me here on the forums!