Skip to content

Commit

Permalink
Passenger Mounting
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSheps committed Oct 19, 2018
1 parent edb8fc0 commit 99b2cf7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
38 changes: 31 additions & 7 deletions BeStride_ActionButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,23 @@ function BeStride_ActionButtonRegularMount:PreClick()
return
end

local mount = BeStride_Logic:Regular()
if mount ~= nil then
self:SetAttribute("macrotext",mount)
BeStride_Debug:Verbose(self:GetAttribute("macrotext"))
local passenger = nil

if IsInGroup() == true and BeStride_Logic:IsFlyable() then
passenger = BeStride_Mount:Passenger("flying")
elseif IsInGroup() == true then
passenger = BeStride_Mount:Passenger()
end

if passenger ~= nil then
BeStride_Debug:Verbose("Mount:" .. tostring(passenger))
self:SetAttribute("macrotext",passenger)
else
local mount = BeStride_Logic:Regular()
if mount ~= nil then
self:SetAttribute("macrotext",mount)
BeStride_Debug:Verbose(self:GetAttribute("macrotext"))
end
end
end

Expand All @@ -70,9 +83,20 @@ function BeStride_ActionButtonGroundMount:PreClick()
return
end

local mount = BeStride_Logic:GroundMountButton()
if mount ~= nil then
self:SetAttribute("macrotext",mount)
local passenger = nil

if IsInGroup() == true then
passenger = BeStride_Mount:Passenger("ground")
end

if passenger ~= nil then
BeStride_Debug:Verbose("Mount:" .. tostring(passenger))
self:SetAttribute("macrotext",passenger)
else
local mount = BeStride_Logic:GroundMountButton()
if mount ~= nil then
self:SetAttribute("macrotext",mount)
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions BeStride_Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ function BeStride_Logic:RepairMountButton()
end
end

function BeStride_Logic:PassengerMountButton()
function BeStride_Logic:PassengerMountButton(type)
if IsMounted() or IsOutdoors() then
return BeStride_Mount:Passenger()
return BeStride_Mount:Passenger(type)
else
return nil
end
Expand Down
4 changes: 2 additions & 2 deletions BeStride_Mount.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ function BeStride_Mount:Repair()
return BeStride_Mount:DoMount(mounts)
end

function BeStride_Mount:Passenger()
function BeStride_Mount:Passenger(type)
local mounts = {}

for k,v in pairs(mountTable["passenger"]) do if self:IsUsable(v) then table.insert(mounts,v) end end
for k,v in pairs(mountTable["passenger"]) do if self:IsUsable(v) and ( (type ~= nil and mountTable.master[v].type) or type == nil ) then table.insert(mounts,v) end end

if #mounts == 0 then
BeStride_Debug:Debug("No Mounts")
Expand Down

0 comments on commit 99b2cf7

Please sign in to comment.