This can lead to issues or even crashes with mods because the stategraphs are very different, but both will process post inits using "bunnyman".
Aside from fixing the issue, maybe there's something you can do with these functions to automatically catch cases like these in the future?
local function LoadStateGraph(name) if StateGraphs[name] == nil then local fn = require("stategraphs/"..name) assert(fn, "could not load stategraph "..name) StateGraphs[name] = fn end local sg = StateGraphs[name] assert(sg, "stategraph "..name.." is not valid") return sg end function EntityScript:SetStateGraph(name) if self.sg ~= nil then SGManager:RemoveInstance(self.sg) end local sg = LoadStateGraph(name) assert(sg ~= nil) if sg ~= nil then self.sg = StateGraphInstance(sg, self) SGManager:AddInstance(self.sg) self.sg:GoToState(self.sg.sg.defaultstate) return self.sg end end
Or maybe even stategraph.lua, within the StateGraph class constructor itself.
Steps to Reproduce
- Make a mod script that adds a stategraph post init of any kind using "bunnyman".
- Notice how it will run for SGrabbitking_bunnyman too, potentially leading to issues or even crashes.
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now