From 3013a285d5d27023a21ba0fc2ed196b4d7a373c3 Mon Sep 17 00:00:00 2001 From: DarkGod <darkgod@net-core.org> Date: Thu, 9 Jul 2020 17:23:22 +0200 Subject: [PATCH] Necromancers can now use the party orders to dismiss any minion Added new hooks "PartyOrder:define" and "PartyOrder:execute" --- game/engines/default/data/keybinds/inventory.lua | 2 +- game/modules/tome/class/Party.lua | 5 +++++ game/modules/tome/data/talents/spells/spells.lua | 4 ++-- game/modules/tome/dialogs/PartyOrder.lua | 6 ++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/game/engines/default/data/keybinds/inventory.lua b/game/engines/default/data/keybinds/inventory.lua index 4f864c6df4..e8ae9a9db6 100644 --- a/game/engines/default/data/keybinds/inventory.lua +++ b/game/engines/default/data/keybinds/inventory.lua @@ -37,7 +37,7 @@ defineAction{ name = _t"Pickup items", } defineAction{ - default = { "sym:=d:false:false:false:false" }, + default = { "sym:=d:false:true:false:false" }, type = "DROP_FLOOR", group = "inventory", name = _t"Drop items", diff --git a/game/modules/tome/class/Party.lua b/game/modules/tome/class/Party.lua index bdc27b54a2..4281c04849 100644 --- a/game/modules/tome/class/Party.lua +++ b/game/modules/tome/class/Party.lua @@ -404,6 +404,9 @@ function _M:giveOrder(actor, order) game:registerDialog(require("mod.dialogs.orders."..order:capitalize()).new(actor, def)) elseif order == "talents" then game:registerDialog(require("mod.dialogs.orders."..order:capitalize()).new(actor, def)) + elseif order == "dismiss" then + game.log("%s is dismissed!", actor:getName():capitalize()) + actor:die(actor) ------------------------------------------- -- Escort specifics @@ -422,6 +425,8 @@ function _M:giveOrder(actor, order) local dir = game.level.map:compassDirection(actor.escort_target.x - actor.x, actor.escort_target.y - actor.y) actor:doEmote(("The portal is %s, to the %s."):tformat(dist, dir or "???"), 45) + else + self:triggerHook{"PartyOrder:execute", order=order, actor=actor} end return true diff --git a/game/modules/tome/data/talents/spells/spells.lua b/game/modules/tome/data/talents/spells/spells.lua index f2ecaba198..6ecac8334a 100644 --- a/game/modules/tome/data/talents/spells/spells.lua +++ b/game/modules/tome/data/talents/spells/spells.lua @@ -244,10 +244,10 @@ function necroSetupSummon(self, def, x, y, level, turns, no_control) m.remove_from_party_on_death = true game.party:addMember(m, { - control=can_control and "full" or "no", + control=can_control and "full" or "order", type="minion", title=_t"Necrotic Minion", - orders = {target=true}, + orders = {target=true, dismiss=true}, }) end m:resolve() m:resolve(nil, true) diff --git a/game/modules/tome/dialogs/PartyOrder.lua b/game/modules/tome/dialogs/PartyOrder.lua index 545b94d692..d75693ea03 100644 --- a/game/modules/tome/dialogs/PartyOrder.lua +++ b/game/modules/tome/dialogs/PartyOrder.lua @@ -32,6 +32,7 @@ local orders = { leash = {4, function(actor) return ("Set the leash distance [current: %d]"):tformat(actor.ai_state.tactic_leash) end}, talents = {5, function(actor) return (_t"Define tactical talents usage") end}, rename = {6, function(actor) return (_t"Rename") end}, + dismiss = {7, function(actor) return (_t"Dismiss") end}, } function _M:init(actor, def) @@ -65,6 +66,11 @@ end function _M:generateList() local list = {} + if not _M.additional_hook_fired then + _M.additional_hook_fired = true + self:triggerHook{"PartyOrder:define", orders=orders} + end + for o, _ in pairs(self.def.orders) do if orders[o] then list[#list+1] = {name=orders[o][2](self.actor), order=o, sort=orders[o][1]} -- GitLab