# HG changeset patch # User syzler # Date 1301964590 0 # Node ID a4711e3c1eeffe016b0db6e07a4e2907a67c51fe # Parent 7e41cf184b8a4f810786aaa6bcf1851d5091470f Fixed the basic CallMount function to ignore already summoned mounts. diff -r 7e41cf184b8a -r a4711e3c1eef libMyLilPony/libMyLilPony_mountFunctions.lua --- a/libMyLilPony/libMyLilPony_mountFunctions.lua Mon Apr 04 04:58:43 2011 +0000 +++ b/libMyLilPony/libMyLilPony_mountFunctions.lua Tue Apr 05 00:49:50 2011 +0000 @@ -16,15 +16,15 @@ -- API functions for calling mounts +--- Summons a random mount. +-- Does nothing if the only available mount is already summoned. +-- @return A Boolean value indicating whether or not a new mount was summoned. function MyLilPony.CallMount() - local countMounts = GetNumCompanions("MOUNT"); - if countMounts > 0 then - local i = random(1, countMounts); + local filter = function (i) local _, _, _, _, summoned = GetCompanionInfo("MOUNT", i); - MyLilPony.CallCompanion("MOUNT", i, not summoned); - return true; + return not summoned; end - return false; + return MyLilPony.CallMountByFilter(filter); end function MyLilPony.CallFlyingMount()