Skip to content

Latest commit

 

History

53 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

MoonPlus

A Roblox plugin that allows you to mod Moon Animator 2.

Link to Plugin

This also has premade mods, such as:

  • Autosave (Configurable)
  • Audio Support
  • Bézier Easing
  • Catalog / Accessory Inserter
  • Outfit Loader
  • UI Support

Support Moon Animator!

Scripting

Moon Animator Documentation (unfinished)

local _g = _G.MoonGlobal
local MoonPlus = _g.MoonPlus

Functions

If you wanna add your own mod, these are some functions that might help.

MoonPlus.wfv()

MoonPlus.wfv(
  index: any,
  tbl: { any } -- Default = _g
) -> tbl[index] -- wfv = WaitForVariable

Waits for a variable in a table.

MoonPlus.NewSignal()

MoonPlus.NewSignal(
  name: string?
) -> Signal -- equals to require(_g.class.Signal):new(name)

Creates a Signal, example:

local Signal = MoonPlus.NewSignal("Example")

Signal:Connect(function(a1, a2)
  print(a1 * a2)
end)

Signal:Once(function(a1, a2)
  print(a1 + a2)
end)

Signal:Fire(25, 5) -- prints "125" then "30"
Signal:Fire(4, 9) -- prints "36"

-- Other Functions:
--   Signal:Wait()
--   Signal:Destroy()

MoonPlus.hookfunction()

type HookTable = {
  orig =  function,
  hooked = function,

  before = { function },
  after = { function }
}

MoonPlus.hookfunction(
  tbl: { any },
  method: any,
  hook: ( any ) -> any,
  hooktype: "before" | "after" -- Default = "before"
) -> HookTable

Changes a function inside a table, example:

local t = {}
t.func = function(arg)
  print("original called,", arg)
  return arg + 10
end

print( t.func(4) )
-- the line above will print "original called, 4", then "14"

MoonPlus.hookfunction(
  t, "func",
  function(arg)
    return arg * 2
  end,
  "before"
)

MoonPlus.hookfunction(
  t, "func",
  function(arg)
    print("returned", arg)
    return arg
  end,
  "after"
)

print( t.func(4) )
-- the line above will print "original called, 8", then "returned 18", then "18"

MoonPlus.gethooktable()

MoonPlus.gethooktable( hooked: function ) -> HookTable?

Gets a HookTable from a hooked function, returns nil if it is not a hooked function.

Signals

imitates RBXScriptSignal

local Signals = MoonPlus.Signals

-- .Updated
Signals.Updated:Connect(function(frame) -- frame: number
  print(frame)
end)
-- fires everytime the animator changes keyframe

-- .FileOpened
Signals.FileOpened:Connect(function(file) -- file: StringValue
  print(file)
end)
-- fires everytime you open a file

Example Mod

This Mod shows a popup when opening Moon Animator

local _g = _G.MoonGlobal
local MoonPlus = _g.MoonPlus

-- wait for MoonPlus to load
repeat MoonPlus = _g.MoonPlus wait() until MoonPlus

local once = false

-- hook _g.Windows.MoonAnimator.OnOpen
MoonPlus.hookfunction(
  _g.Windows.MoonAnimator, "OnOpen",
  function(pass)
    if not once then
      once = true
      -- add a delay so it doesn't break
      delay(0.1, function()
        -- shows the popup
        _g.Windows.MsgBox.Popup(_g.Windows.MoonAnimator,
          {
            Title = "Example Mod", 
            Content = "Hello world!",
            Button1 = {"ok", _g.BLANK_FUNC},
            Button2 = {"cool", _g.BLANK_FUNC}
          })
      end)
    end
    
    return pass
  end,
  'after'
)

About

A Roblox plugin that allows you to mod Moon Animator 2.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Contributors