From 3d8f52e7d881cb122a01d5d903bbaef88aa65557 Mon Sep 17 00:00:00 2001 From: Zachary Dziura Date: Fri, 14 Oct 2016 19:51:27 -0400 Subject: [PATCH] More updates to both the Combateering and Empathing systems Now when you call TTAR and GM for Combateering and Empathing respectively, the actions queue is reset. This should hopefully help to fix some deadlocking issues that arise. --- Dreadnought.xml | 262 ++++++++++++++++++++++++++---------------------- README.md | 1 + 2 files changed, 142 insertions(+), 121 deletions(-) diff --git a/Dreadnought.xml b/Dreadnought.xml index 3edadf9..0680a89 100644 --- a/Dreadnought.xml +++ b/Dreadnought.xml @@ -40,7 +40,7 @@ disableTrigger("Autopilot") send("config shipsight 1", false) send("config aethermap on", false) -local reset = dreadnought.pilot.reset() +local reset = dreadnought.reset.pilot() dreadnought.aetherbeastsTotal = reset.aetherbeastsTotal dreadnought.currentModule = matches[2] dreadnought.pilot = reset.pilot @@ -72,7 +72,7 @@ disableTrigger("Autopilot") send("config shipsight 0", false) send("config aethermap off", false) -local reset = dreadnought.pilot.reset() +local reset = dreadnought.reset.pilot() dreadnought.aetherbeastsTotal = reset.aetherbeastsTotal dreadnought.currentModule = reset.currentModule dreadnought.pilot = reset.pilot @@ -730,67 +730,19 @@ dmsg("The empathic grid is set up and ready for your control.")#000000 - - Damaged - - 0 - 0 - 0 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - concussive shock rips through the hull.$ - swiftly shears through her hull.$ - rips apart her hull.$ - shreds deep rends through her hull.$ - ^Violet sparks fly through the air and - ^\(Ship\): \w+ says, \"Repair.\"$ - cries out as bolts of jagged energy strike out from the ruptured fabric of aetherspace here.$ - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - - Repairing - - 0 - 0 - 0 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - ^You send a surge of strength through the empathic grid - - - 1 - - Repaired - + if action.name == "hull" then + dreadnought.heap.extract(dreadnought.actions) + else + break + end +end 0 0 0 @@ -810,7 +762,7 @@ action.postCommand() - Repair + Modules dreadnought.empath.slivvensFound = 0 dreadnought.empath.flags.checkSlivven = false -end +end + +dreadnought.repairShip(dreadnought.actions) 0 0 0 @@ -909,12 +863,11 @@ end Repairing +end 0 0 0 @@ -926,10 +879,16 @@ action.postCommand() #000000 #000000 - ^Crackling energy surges to (?:\w+\s){2}(\w+), (\w+) healing it\.$ + You send a surge of strength through the empathic grid As you attempt to operate the empathic grid, it sputters and gyrates without producing a noticeable result. + The empathic grid is not yet ready to be used again. + ^Crackling energy surges to (?:a|an) \w+ (\w+), fully healing it\.$ + The empathic grid is not yet ready to be used again. + 2 + 3 + 3 1 3 @@ -1053,10 +1012,10 @@ action.postCommand() - Aetherbeast Dead + Target Destroyed 0 0 @@ -1098,6 +1057,8 @@ end dreadnought.action("planarbond", 1, "grid planarbond")) dreadnought.heap.insert(dreadnought.actions, dreadnought.action("covey", 1, "grid covey")) + + dreadnought.repairShip(dreadnought.actions) end 0 0 @@ -1110,7 +1071,7 @@ end #000000 #000000 - ^(?:\w+\s?)+ launches into the aetherways\.$ + ^[\w\'\s]+ launches into the aetherways\.$ 1 @@ -1136,7 +1097,7 @@ action.postCommand() #000000 #000000 - ^You point out to (?:\w+\s?)+ that \w+ has a covey\.$ + ^You point out to [\w\'\s]+ that she has a covey\.$ 1 @@ -1162,7 +1123,7 @@ action.postCommand() #000000 #000000 - ^You direct (?:\w+\s?)+ to form a deep planar bond with the crew, rooting each of them to the distant aetherwaves\.$ + ^You direct [\w\'\s]+ to form a deep planar bond with the crew, rooting each of them to the distant aetherwaves\.$ 1 @@ -1171,7 +1132,8 @@ action.postCommand() Slivven Check - 0 0 @@ -1192,6 +1154,36 @@ send("grid modules", false) 1 + + Prompt + + 0 + 0 + 0 + + + #ff0000 + #ffff00 + + #000000 + #000000 + + ^\[(\d+)\-hull, \d+\-power, \w+ damage, \d+\-will \*x?\*\]$ + + + 1 + + Combateer @@ -1358,20 +1350,20 @@ dreadnought.fireTurret(dreadnought.actions) Targeting 0 @@ -1396,7 +1388,7 @@ end Target Acquired #000000 #000000 - ^You tune the weapon module to target (?:a|an) (?:\w+\-?\s?)+\.$ + ^You tune the weapon module to target (?:a|an) [\w\-\s]+\.$ No such creature is close enough for a battle turret to get a targeting lock. @@ -1557,10 +1549,10 @@ end - Beast Dies + Target Destroyed 0 @@ -1584,7 +1576,7 @@ end No Target #000000 A battle turret is not targeting anything. + No such creature is close enough for a battle turret to get a targeting lock. 3 + 3 @@ -2125,7 +2119,7 @@ end 1 - + Gags 0 @@ -2471,8 +2465,9 @@ end Grid Modules - - grid modules + + ^gm$ @@ -2505,6 +2500,7 @@ dreadnought.repairShip(dreadnought.actions) Reset Set Target - end local exch = function(h, x, y) + assert(type(h) == "table") assert(type(x) == "number") assert(type(y) == "number") @@ -2707,28 +2706,25 @@ local exch = function(h, x, y) end local sink = function(h, parentIndex) - local N = h.size - - while (parentIndex*2) <= N do + while (parentIndex*2) < h.size do local childIndex = parentIndex * 2 - if childIndex < N and lowerPriority(h.elements[childIndex], + if childIndex < h.size and lowerPriority(h.elements[childIndex], h.elements[childIndex+1]) then childIndex = childIndex + 1 end - if not lowerPriority(h.elements[parentIndex], h.elements[childIndex]) then - break - else + if lowerPriority(h.elements[parentIndex], h.elements[childIndex]) then exch(h, parentIndex, childIndex) parentIndex = childIndex + else + break end end end local swim = function(h, childIndex) - while childIndex > 1 and lowerPriority(h.elements[math.floor(childIndex/2)], - h.elements[childIndex]) do + while childIndex > 1 and lowerPriority(h.elements[math.floor(childIndex / 2)], h.elements[childIndex]) do local parentIndex = math.floor(childIndex / 2) exch(h, childIndex, parentIndex) childIndex = parentIndex @@ -2752,7 +2748,11 @@ dreadnought.heap = { extract = function(h) exch(h, 1, h.size) - h.size = h.size - 1 + + if h.size > 0 then + h.size = h.size - 1 + end + local ret = table.remove(h.elements) sink(h, 1) @@ -2785,20 +2785,26 @@ dreadnought.heap = { local cmd -- The command to execute the given action command if type(command) == "string" then cmd = function() - send(command, false) - dreadnought.locked = true + if dreadnought.balance and not dreadnought.locked then + send(command, false) + dreadnought.locked = true + end end elseif type(command) == "table" then cmd = function() - for _,v in ipairs(command) do - send(v, false) + if dreadnought.balance and not dreadnought.locked then + for _,v in ipairs(command) do + send(v, false) + end + dreadnought.locked = true end - dreadnought.locked = true end else cmd = function() - command() - dreadnought.locked = true + if dreadnought.balance and not dreadnought.locked then + command() + dreadnought.locked = true + end end end @@ -2809,11 +2815,16 @@ dreadnought.heap = { postCommand = postCommand } - setmetatable(action, { + local mt = { __lt = function(a, b) - return a.priority < b.priority + return a.priority > b.priority + end, + + __le = function(a, b) + return a.priority >= b.priority end - }) + } + setmetatable(action, mt) return action end @@ -2945,6 +2956,11 @@ end Empath checkSlivven = false }, - slivvensFound = 0 + slivvensFound = 0, + inspectedModule = "" } function dreadnought.reset.empath() - sendGMCP([[Char.Skills.Get {"group":"aethercraft"}]]) - send("\n") - deleteLineP() - return { aetherbeastsTotal = 0, currentModule = "", actions = dreadnought.heap.new(), empath = { + hull = { + current = 0, + max = 0 + }, + modules = { chair = "", grid = "", @@ -2983,13 +3001,14 @@ function dreadnought.reset.empath() cube = "" }, - skills = {}, + skills = dreadnought.empath.skills, flags = { checkSlivven = false }, - slivvensFound = 0 + slivvensFound = 0, + inspectedModule = "" } } end @@ -3022,7 +3041,7 @@ function dreadnought.reset.combateer() actions = dreadnought.heap.new(), combateer = { - skills = {}, + skills = dreadnought.combateer.skills, flags = { canVortex = false } @@ -3081,6 +3100,7 @@ end Astralsight = true, Purser = true, Scan = true, + FirstMate = true, Resonance = true } diff --git a/README.md b/README.md index 6cc5c3b..9185054 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ An automated aetherhunting system for Lusternia, written in Lua for the Mudlet c Installation ---------- +0. Make sure that the GMCP is enabled before installing. You can double-check by clicking on the `Settings` button within Mudlet, and within the `General` tab there is a checkbox to "Enable GMCP". If not checked off, check that box, click "Save", then restart Mudlet. 1. Click on the green button above labeled `Clone or download`. From the dropdown that appears, click `Download ZIP`. 2. Extract the zip file somewhere on your computer (such as your Downloads folder). 3. Open Mudlet. On the Menu Bar, click on `Package Manager`.