public void WorldLoaded(World w, WorldRenderer wr) { world = w; sma = world.WorldActor.Trait <SpawnMapActors>(); context.Lua["World"] = w; context.Lua["WorldRenderer"] = wr; context.RegisterObject(this, "Internal", false); context.RegisterType(typeof(WVec), "WVec", true); context.RegisterType(typeof(CVec), "CVec", true); context.RegisterType(typeof(WPos), "WPos", true); context.RegisterType(typeof(CPos), "CPos", true); context.RegisterType(typeof(WRot), "WRot", true); context.RegisterType(typeof(WAngle), "WAngle", true); context.RegisterType(typeof(WRange), "WRange", true); context.RegisterType(typeof(int2), "int2", true); context.RegisterType(typeof(float2), "float2", true); var sharedScripts = Game.modData.Manifest.LuaScripts ?? new string[0]; if (sharedScripts.Any()) { context.LoadLuaScripts(f => GlobalFileSystem.Open(f).ReadAllText(), sharedScripts); } AddMapActorGlobals(); context.LoadLuaScripts(f => w.Map.Container.GetContent(f).ReadAllText(), info.LuaScripts); context.InvokeLuaFunction("WorldLoaded"); }
public MapGlobal(ScriptContext context) : base(context) { sma = context.World.WorldActor.Trait<SpawnMapActors>(); // Register map actors as globals (yuck!) foreach (var kv in sma.Actors) context.RegisterMapActor(kv.Key, kv.Value); }
public MapGlobal(ScriptContext context) : base(context) { sma = context.World.WorldActor.Trait <SpawnMapActors>(); // Register map actors as globals (yuck!) foreach (var kv in sma.Actors) { context.RegisterMapActor(kv.Key, kv.Value); } }