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"); }
void IWorldLoaded.WorldLoaded(World w, OpenRA.Graphics.WorldRenderer wr) { mapOptions = w.WorldActor.Trait <MapOptions>(); if (string.IsNullOrWhiteSpace(info.CountdownLabel) || string.IsNullOrWhiteSpace(info.CountdownText)) { return; } countdownLabel = Ui.Root.GetOrNull <LabelWidget>(info.CountdownLabel); if (countdownLabel != null) { countdown = new CachedTransform <int, string>(t => info.CountdownText.F(WidgetUtils.FormatTime(t, true, w.IsReplay ? mapOptions.GameSpeed.Timestep : w.Timestep))); countdownLabel.GetText = () => countdown.Update(ticksRemaining); } }
public void InitPalette(OpenRA.Graphics.WorldRenderer wr) { wr.AddPalette(info.Name, new Palette(FileSystem.Open(world.TileSet.Palette), info.ShadowIndex)); }
public void InitPalette(OpenRA.Graphics.WorldRenderer wr) { string Filename = world.TileSet.PlayerPalette == null ? world.TileSet.Palette : world.TileSet.PlayerPalette; wr.AddPalette(info.Name, new Palette(FileSystem.Open(Filename), info.ShadowIndex), info.AllowModifiers); }