示例#1
0
        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");
        }
示例#2
0
		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);
		}
示例#3
0
        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);
            }
        }