public SupportPowerTimerWidget(World world) { powers = world.ActorsWithTrait<SupportPowerManager>() .Where(p => !p.Actor.IsDead() && !p.Actor.Owner.NonCombatant) .SelectMany(s => s.Trait.Powers.Values) .Where(p => p.Instances.Any() && p.Info.DisplayTimer && !p.Disabled); }
public override bool OnBlockPlaced(World world, Vector3 position, Vector3 clickedBlock, Vector3 clickedSide, Vector3 cursorPosition, Entities.Entity usedBy) { Metadata = (byte)MathHelper.DirectionByRotationFlat(usedBy); switch ((Direction)Metadata) { case Direction.North: Metadata = (byte)StairDirections.North; break; case Direction.South: Metadata = (byte)StairDirections.South; break; case Direction.West: Metadata = (byte)StairDirections.West; break; case Direction.East: Metadata = (byte)StairDirections.East; break; } if (clickedSide == Vector3.Down) Metadata |= 4; else if (clickedSide != Vector3.Up) { if (cursorPosition.Y >= 8) Metadata |= 4; } return true; }
public static void ApplySetPieces(World world) { var map = world.Map; int w = map.Width, h = map.Height; Random rand = new Random(); HashSet<Rect> rects = new HashSet<Rect>(); foreach (var dat in setPieces) { int size = dat.Item1.Size; int count = rand.Next(dat.Item2, dat.Item3); for (int i = 0; i < count; i++) { IntPoint pt = new IntPoint(); Rect rect; int max = 50; do { pt.X = rand.Next(0, w); pt.Y = rand.Next(0, h); rect = new Rect() { x = pt.X, y = pt.Y, w = size, h = size }; max--; } while ((Array.IndexOf(dat.Item4, map[pt.X, pt.Y].Terrain) == -1 || rects.Any(_ => Rect.Intersects(rect, _))) && max > 0); if (max <= 0) continue; dat.Item1.RenderSetPiece(world, pt); rects.Add(rect); } } }
public Smoke(World world, PPos pos, string trail) { this.pos = pos; anim = new Animation(trail); anim.PlayThen("idle", () => world.AddFrameEndTask(w => w.Remove(this))); }
public void DoControlGroup(World world, int group, Modifiers mods) { if (mods.HasModifier(Modifiers.Ctrl)) { if (actors.Count == 0) return; controlGroups[group].Clear(); for (var i = 0; i < 10; i++) /* all control groups */ controlGroups[i].RemoveAll(a => actors.Contains(a)); controlGroups[group].AddRange(actors); return; } if (mods.HasModifier(Modifiers.Alt)) { Game.viewport.Center(controlGroups[group]); return; } Combine(world, controlGroups[group], mods.HasModifier(Modifiers.Shift), false); }
public ObserverSupportPowerIconsWidget(World world, WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; clocks = new Dictionary<string, Animation>(); icon = new Animation(world, "icon"); }
public void RenderSetPiece(World world, IntPoint pos) { var deepWaterRadius = 1f; var border = new List<IntPoint>(); var t = new int[Size, Size]; for (var y = 0; y < Size; y++) //Replace Deep Water With NWater for (var x = 0; x < Size; x++) { var dx = x - (Size/2.0); var dy = y - (Size/2.0); var r = Math.Sqrt(dx*dx + dy*dy); if (r <= deepWaterRadius) { t[x, y] = 1; } } for (var x = 0; x < Size; x++) for (var y = 0; y < Size; y++) { if (t[x, y] == 1) { var tile = world.Map[x + pos.X, y + pos.Y].Clone(); tile.TileId = Water; tile.ObjType = 0; world.Obstacles[x + pos.X, y + pos.Y] = 0; world.Map[x + pos.X, y + pos.Y] = tile; } } }
public ProductionQueueFromSelection(World world, ProductionQueueFromSelectionInfo info) { this.world = world; tabsWidget = new Lazy<ProductionTabsWidget>(() => Widget.RootWidget.GetWidget<ProductionTabsWidget>(info.ProductionTabsWidget)); }
public void Tick(World world) { if (--remaining <= 0) world.AddFrameEndTask(w => w.Remove(this)); pos += velocity; }
public static Bitmap ActorsBitmap(World world) { var map = world.Map; var size = Util.NextPowerOf2(Math.Max(map.Bounds.Width, map.Bounds.Height)); Bitmap bitmap = new Bitmap(size, size); var bitmapData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); unsafe { int* c = (int*)bitmapData.Scan0; foreach (var t in world.Queries.WithTrait<IRadarSignature>()) { if (!world.LocalShroud.IsVisible(t.Actor)) continue; var color = t.Trait.RadarSignatureColor(t.Actor); foreach (var cell in t.Trait.RadarSignatureCells(t.Actor)) if (world.Map.IsInMap(cell)) *(c + ((cell.Y - world.Map.Bounds.Top) * bitmapData.Stride >> 2) + cell.X - world.Map.Bounds.Left) = color.ToArgb(); } } bitmap.UnlockBits(bitmapData); return bitmap; }
public IEnumerable<Order> Order(World world, int2 xy, MouseInput mi) { if (mi.Button == MouseButton.Right) world.CancelInputMode(); return OrderInner(world, xy, mi); }
public void Tick(World world) { if (!a.IsInWorld || a.IsDead() || !a.Trait<CanPowerDown>().Disabled) world.AddFrameEndTask(w => w.Remove(this)); anim.Tick(); }
protected MapItem(IntVector2 hexQuoords, World world) { HexQuoordinates = hexQuoords; World = world; Tasks = new Queue<Task>(); }
public ProductionQueueFromSelection(World world, ProductionQueueFromSelectionInfo info) { this.world = world; tabsWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.ProductionTabsWidget) as ProductionTabsWidget); paletteWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.ProductionPaletteWidget) as ProductionPaletteWidget); }
public void Test_Distance() { var node1 = new Node ("Node1"); var col1 = new CollisionObject (); col1.Shape = new BoxShape (1, 1, 1); node1.Attach (col1); var node2 = new Node ("Node2"); var col2 = new CollisionObject (); col2.Shape = new BoxShape (1, 1, 1); node2.Attach (col2); var wld = new World (); wld.AddChild (node1); wld.AddChild (node2); node1.Translate (0, 0, 0); node2.Translate (0, 0, 0); Assert.AreEqual (0, wld.Distance (node1, node2)); node1.Translate (0, 0, 0); node2.Translate (10, 0, 0); Assert.AreEqual (8, wld.Distance (node1, node2), 0.01f); node1.Rotate (0, 0, 0, 0); node2.Rotate (45, 0, 0, 1); Assert.AreEqual (7.6f, wld.Distance (node1, node2), 0.01f); node1.Detach (col1); node2.Detach (col2); Assert.AreEqual (Single.NaN, wld.Distance (node1, node2), 0.01f); }
public void RenderSetPiece(World world, IntPoint pos) { for (int x = 0; x < Size; x++) for (int y = 0; y < Size; y++) { double dx = x - (Size / 2.0); double dy = y - (Size / 2.0); double r = Math.Sqrt(dx * dx + dy * dy) + rand.NextDouble() * 4 - 2; if (r <= 10) { var tile = world.Map[x + pos.X, y + pos.Y].Clone(); tile.TileId = Floor; tile.ObjType = 0; world.Obstacles[x + pos.X, y + pos.Y] = 0; world.Map[x + pos.X, y + pos.Y] = tile; } } Entity lord = Entity.Resolve(0x675); lord.Move(pos.X + 15.5f, pos.Y + 15.5f); world.EnterWorld(lord); Container container = new Container(0x0501, null, false); int count = rand.Next(5, 8); List<Item> items = new List<Item>(); while (items.Count < count) { Item item = chest.GetRandomLoot(rand); if (item != null) items.Add(item); } for (int i = 0; i < items.Count; i++) container.Inventory[i] = items[i]; container.Move(pos.X + 15.5f, pos.Y + 15.5f); world.EnterWorld(container); }
public GameInfoObjectivesLogic(Widget widget, World world) { var lp = world.LocalPlayer; var missionStatus = widget.Get<LabelWidget>("MISSION_STATUS"); missionStatus.GetText = () => lp.WinState == WinState.Undefined ? "In progress" : lp.WinState == WinState.Won ? "Accomplished" : "Failed"; missionStatus.GetColor = () => lp.WinState == WinState.Undefined ? Color.White : lp.WinState == WinState.Won ? Color.LimeGreen : Color.Red; var mo = lp.PlayerActor.TraitOrDefault<MissionObjectives>(); if (mo == null) return; var objectivesPanel = widget.Get<ScrollPanelWidget>("OBJECTIVES_PANEL"); template = objectivesPanel.Get<ContainerWidget>("OBJECTIVE_TEMPLATE"); PopulateObjectivesList(mo, objectivesPanel, template); Action<Player> redrawObjectives = player => { if (player == lp) PopulateObjectivesList(mo, objectivesPanel, template); }; mo.ObjectiveAdded += redrawObjectives; }
public void Test_CollideWith() { var node1 = new Node ("Node1"); node1.Attach(new CollisionObject ()); node1.CollisionObject.Shape = new BoxShape (1, 1, 1); node1.GroupID = 1; var node2 = new Node ("Node2"); node2.Attach (new CollisionObject ()); node2.CollisionObject.Shape = new BoxShape (1, 1, 1); node2.GroupID = 2; var wld = new World (); wld.AddChild (node1); wld.AddChild (node2); node1.CollisionObject.CollideWith = -1; Assert.AreEqual (true, wld.Overlap (node1, node2)); node1.CollisionObject.CollideWith = 1; Assert.AreEqual (false, wld.Overlap (node1, node2)); node1.CollisionObject.CollideWith = 2; Assert.AreEqual (true, wld.Overlap (node1, node2)); node1.CollisionObject.CollideWith = 2; node1.CollisionObject.IgnoreWith = 2; Assert.AreEqual (false, wld.Overlap (node1, node2)); }
public Corpse(World world, float2 pos, string image, string sequence, string paletteName) { this.pos = pos; this.paletteName = paletteName; anim = new Animation(image); anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this))); }
public void RenderSetPiece(World world, IntPoint pos) { var cooledRadius = 15; var t = new int[Size, Size]; for (var y = 0; y < Size; y++) for (var x = 0; x < Size; x++) { var dx = x - Size / 2.0; var dy = y - Size / 2.0; var r = Math.Sqrt(dx * dx + dy * dy); if (r <= cooledRadius) t[x, y] = 1; } for (var x = 0; x < Size; x++) for (var y = 0; y < Size; y++) { if (t[x, y] == 1) { var tile = world.Map[x + pos.X, y + pos.Y].Clone(); tile.TileId = Cooled; tile.ObjType = 0; if (world.Obstacles[x + pos.X, y + pos.Y] == 0) world.Map[x + pos.X, y + pos.Y] = tile; } } }
public TerrainRenderer(World world, WorldRenderer wr) { this.world = world; this.map = world.Map; var tileSize = new Size( Game.CellSize, Game.CellSize ); var tileMapping = new Cache<TileReference<ushort,byte>, Sprite>( x => Game.modData.SheetBuilder.Add(world.TileSet.GetBytes(x), tileSize)); var vertices = new Vertex[4 * map.Bounds.Height * map.Bounds.Width]; terrainSheet = tileMapping[map.MapTiles.Value[map.Bounds.Left, map.Bounds.Top]].sheet; int nv = 0; var terrainPalette = wr.Palette("terrain").Index; for( int j = map.Bounds.Top; j < map.Bounds.Bottom; j++ ) for( int i = map.Bounds.Left; i < map.Bounds.Right; i++ ) { var tile = tileMapping[map.MapTiles.Value[i, j]]; // TODO: move GetPaletteIndex out of the inner loop. Util.FastCreateQuad(vertices, Game.CellSize * new float2(i, j), tile, terrainPalette, nv, tile.size); nv += 4; if (tileMapping[map.MapTiles.Value[i, j]].sheet != terrainSheet) throw new InvalidOperationException("Terrain sprites span multiple sheets"); } vertexBuffer = Game.Renderer.Device.CreateVertexBuffer( vertices.Length ); vertexBuffer.SetData( vertices, nv ); }
public ViewportControllerWidget(World world, WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get<TooltipContainerWidget>(TooltipContainer)); }
public override void OnItemUsedOnBlock(World world, Vector3 clickedBlock, Vector3 clickedSide, Vector3 cursorPosition, Entities.Entity usedBy) { var block = new MelonStemBlock(); if (block.OnBlockPlaced(world, clickedBlock + clickedSide, clickedBlock, clickedSide, cursorPosition, usedBy)) world.SetBlock(clickedBlock + clickedSide, block); base.OnItemUsedOnBlock(world, clickedBlock, clickedSide, cursorPosition, usedBy); }
public void TestBuckets() { World world = new World(new Level(), new FlatlandGenerator()); world.WorldGenerator.Initialize(new Level()); PlayerEntity player = new PlayerEntity(Difficulty.Normal) { GameMode = GameMode.Creative }; Vector3 targetBlock = new Vector3(0, 2, 0); Vector3 alteredBlock = targetBlock + Vector3.Up; world.SetBlock(alteredBlock, new AirBlock()); BucketItem bucket = new BucketItem(); LavaBucketItem lavaBucket = new LavaBucketItem(); WaterBucketItem waterBucket = new WaterBucketItem(); // TODO: Survival tests waterBucket.OnItemUsedOnBlock(world, targetBlock, Vector3.Up, Vector3.Zero, player); Assert.AreEqual(new WaterFlowingBlock(), world.GetBlock(alteredBlock)); bucket.OnItemUsedOnBlock(world, targetBlock, Vector3.Up, Vector3.Zero, player); Assert.AreEqual(new AirBlock(), world.GetBlock(alteredBlock)); lavaBucket.OnItemUsedOnBlock(world, targetBlock, Vector3.Up, Vector3.Zero, player); Assert.AreEqual(new LavaFlowingBlock(), world.GetBlock(alteredBlock)); bucket.OnItemUsedOnBlock(world, targetBlock, Vector3.Up, Vector3.Zero, player); Assert.AreEqual(new AirBlock(), world.GetBlock(alteredBlock)); world.SetBlock(alteredBlock, new BedrockBlock()); bucket.OnItemUsedOnBlock(world, targetBlock, Vector3.Up, Vector3.Zero, player); Assert.AreEqual(new BedrockBlock(), world.GetBlock(alteredBlock)); }
public override void Update(World world) { if (rect.Intersects(world.player.hitbox)) { if (!triggered) { triggered = true; Trigger(world); } } else { triggered = false; } /*if (id == 0) { rect.X += 1; if (rect.Intersects(world.player.hitbox)) { world.LoadWorld(1); } } if (id == 1) { }*/ }
public override void Shoot(World world) { Rocket rocket1 = Game.Objects.CreateRocket(Owner.Position + new Vector2(-40f * Maf.Cos(Owner.Rotation), -40f * Maf.Sin(Owner.Rotation)), Owner.Speed, Owner.Rotation); Rocket rocket2 = Game.Objects.CreateRocket(Owner.Position + new Vector2(40f * Maf.Cos(Owner.Rotation), 40f * Maf.Sin(Owner.Rotation)), Owner.Speed, Owner.Rotation); world.Add(rocket1); world.Add(rocket2); }
public static void PrefabMist( World world, Entity entity ) { if (world.IsClientSide) { //entity.Attach( new ModelView( entity, world, @"scenes\weapon\projRocket", "rocket", Matrix.Scaling(0.1f), Matrix.Identity ) ); entity.Attach( new SfxView( entity, world, "Mist" ) ); } }
public ProductionPaletteWidget([ObjectCreator.Param] World world, [ObjectCreator.Param] WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; tooltipContainer = new Lazy<TooltipContainerWidget>(() => Widget.RootWidget.GetWidget<TooltipContainerWidget>(TooltipContainer)); cantBuild = new Animation("clock"); cantBuild.PlayFetchIndex("idle", () => 0); clock = new Animation("clock"); iconSprites = Rules.Info.Values .Where(u => u.Traits.Contains<BuildableInfo>() && u.Name[0] != '^') .ToDictionary( u => u.Name, u => Game.modData.SpriteLoader.LoadAllSprites( u.Traits.Get<TooltipInfo>().Icon ?? (u.Name + "icon"))[0]); overlayFont = Game.Renderer.Fonts["TinyBold"]; holdOffset = new float2(32,24) - overlayFont.Measure("On Hold") / 2; readyOffset = new float2(32,24) - overlayFont.Measure("Ready") / 2; timeOffset = new float2(32,24) - overlayFont.Measure(WidgetUtils.FormatTime(0)) / 2; queuedOffset = new float2(4,2); }
public void Tick(World world) { if (self.IsDead) world.AddFrameEndTask(w => w.Remove(this)); else anim.Tick(); }
public Thrower(Vector2f pos, World parent, bool add = true) : base(Rsc.Tex("rsc/Throw.png"), pos, parent, add) { Origin = new Vector2f(32, 1); _visible = false; Col.A = 100; }
/// <summary> /// This is a high-level function to cuts fixtures inside the given world, using the start and end points. /// Note: We don't support cutting when the start or end is inside a shape. /// </summary> /// <param name="world">The world.</param> /// <param name="start">The startpoint.</param> /// <param name="end">The endpoint.</param> /// <returns>True if the cut was performed.</returns> public static bool Cut(World world, Vector2 start, Vector2 end) { List <Fixture> fixtures = new List <Fixture>(); List <Vector2> entryPoints = new List <Vector2>(); List <Vector2> exitPoints = new List <Vector2>(); //We don't support cutting when the start or end is inside a shape. if (world.TestPoint(start) != null || world.TestPoint(end) != null) { return(false); } //Get the entry points world.RayCast((f, p, n, fr) => { fixtures.Add(f); entryPoints.Add(p); return(1); }, start, end); //Reverse the ray to get the exitpoints world.RayCast((f, p, n, fr) => { exitPoints.Add(p); return(1); }, end, start); //We only have a single point. We need at least 2 if (entryPoints.Count + exitPoints.Count < 2) { return(false); } for (int i = 0; i < fixtures.Count; i++) { // can't cut circles or edges yet ! if (fixtures[i].Shape.ShapeType != ShapeType.Polygon) { continue; } if (fixtures[i].Body.BodyType != BodyType.Static) { //Split the shape up into two shapes Vertices first; Vertices second; SplitShape(fixtures[i], entryPoints[i], exitPoints[i], out first, out second); //Delete the original shape and create two new. Retain the properties of the body. if (first.CheckPolygon() == PolygonError.NoError) { Body firstFixture = BodyFactory.CreatePolygon(world, first, fixtures[i].Shape.Density, fixtures[i].Body.Position); firstFixture.Rotation = fixtures[i].Body.Rotation; firstFixture.LinearVelocity = fixtures[i].Body.LinearVelocity; firstFixture.AngularVelocity = fixtures[i].Body.AngularVelocity; firstFixture.BodyType = BodyType.Dynamic; } if (second.CheckPolygon() == PolygonError.NoError) { Body secondFixture = BodyFactory.CreatePolygon(world, second, fixtures[i].Shape.Density, fixtures[i].Body.Position); secondFixture.Rotation = fixtures[i].Body.Rotation; secondFixture.LinearVelocity = fixtures[i].Body.LinearVelocity; secondFixture.AngularVelocity = fixtures[i].Body.AngularVelocity; secondFixture.BodyType = BodyType.Dynamic; } world.RemoveBody(fixtures[i].Body); } } return(true); }
private void Barrier_Tick(object sender, EventArgs e) { foreach (var t in barriers.Where(t => t.Exists())) { foreach (var p in World.GetPeds(t.Position, 4f)) { if (p != LPlayer.LocalPlayer.Ped && !p.isInVehicle()) { if (p.Metadata.isBlocked == null) { p.Metadata.isBlocked = true; } if (p.Metadata.isBlocked == true) { p.Task.Wait(-1); p.Task.AlwaysKeepTask = true; } else { p.Task.ClearAll(); p.NoLongerNeeded(); } } if (Common.GetRandomBool(0, 200, 1))//1 in 200 chance to walk away { p.Metadata.isBlocked = false; } } foreach (var v in World.GetVehicles(t.Position, 23f)) { if (Functions.IsPlayerPerformingPullover()) { LHandle pullover = Functions.GetCurrentPullover(); poVeh = Functions.GetPulloverVehicle(pullover); } if (poVeh != null && poVeh.Exists()) { if (v.Exists() && v != poVeh && !v.isSeatFree(VehicleSeat.Driver) && v.Model.Hash != 2452219115 && (long)v.Model.Hash != 1171614426) { Vector3 dimensions = v.Model.GetDimensions(); float num = t.Position.DistanceTo(v.GetOffsetPosition(new Vector3(0.0f, dimensions.Y, 0.0f))); if (num < 6f) { v.GetPedOnSeat(VehicleSeat.Driver).Task.CruiseWithVehicle(v, 0f, true); } else if (num < 10.0f) { v.GetPedOnSeat(VehicleSeat.Driver).Task.CruiseWithVehicle(v, 4f, true); } else if (num < 15.0f) { v.GetPedOnSeat(VehicleSeat.Driver).Task.CruiseWithVehicle(v, 8f, true); } else if (num < 20.0f) { v.GetPedOnSeat(VehicleSeat.Driver).Task.CruiseWithVehicle(v, 12f, true); } } } else { if (v.Exists() && !v.isSeatFree(VehicleSeat.Driver) && v.Model.Hash != 2452219115 && (long)v.Model.Hash != 1171614426) { Vector3 dimensions = v.Model.GetDimensions(); float num = t.Position.DistanceTo(v.GetOffsetPosition(new Vector3(0.0f, dimensions.Y, 0.0f))); if (num < 6f) { v.GetPedOnSeat(VehicleSeat.Driver).Task.CruiseWithVehicle(v, 0f, true); } else if (num < 10.0f) { v.GetPedOnSeat(VehicleSeat.Driver).Task.CruiseWithVehicle(v, 4f, true); } else if (num < 15.0f) { v.GetPedOnSeat(VehicleSeat.Driver).Task.CruiseWithVehicle(v, 8f, true); } else if (num < 20.0f) { v.GetPedOnSeat(VehicleSeat.Driver).Task.CruiseWithVehicle(v, 12f, true); } } } } } }
public void open_sevtixM_menu() { Menu hauptmenu = new Menu("sevtixM", "Hauptmenu") { Visible = true }; MenuController.AddMenu(hauptmenu); MenuItem fahrzeugeButton = new MenuItem("Fahrzeuge"); MenuItem spielerButton = new MenuItem("Spieler"); hauptmenu.AddMenuItem(fahrzeugeButton); hauptmenu.AddMenuItem(spielerButton); hauptmenu.AddMenuItem(new MenuItem("Schliessen")); hauptmenu.OnItemSelect += (_menu, _item, _index) => { int index = _index; switch (index) { case 2: // OPTIONEN hauptmenu.CloseMenu(); break; } }; // --------------------------------------------------------------------- Menu fahrzeuge = new Menu("sevtixM", "Fahrzeuge") { Visible = false }; MenuController.AddSubmenu(hauptmenu, fahrzeuge); MenuItem upgradesButton = new MenuItem("Upgrades", ""); MenuItem reparierenButton = new MenuItem("Reparieren", ""); MenuItem customFahrzeugeButton = new MenuItem("Custom Fahrzeuge", ""); if (!IsPedInVehicle()) { reparierenButton.Enabled = false; upgradesButton.Enabled = false; } else { reparierenButton.Enabled = true; upgradesButton.Enabled = true; } fahrzeuge.AddMenuItem(reparierenButton); fahrzeuge.AddMenuItem(upgradesButton); fahrzeuge.AddMenuItem(customFahrzeugeButton); fahrzeuge.OnItemSelect += (_menu, _item, _index) => { int index = _index; switch (index) { case 0: if (Game.PlayerPed.IsInVehicle()) { Vehicle veh = Game.PlayerPed.CurrentVehicle; veh.Repair(); } else { SendMessageNoVehicleMessage(); } break; } }; // --------------------------------------------------------------------- // --------------------------------------------------------------------- Menu spieler = new Menu("sevtixM", "Spieler") { Visible = false }; MenuController.AddSubmenu(hauptmenu, spieler); spieler.AddMenuItem(new MenuItem("Heilen")); spieler.AddMenuItem(new MenuItem("Fahndungslevel zurücksetzen")); MenuItem godmodeButton = new MenuItem("Godmode"); spieler.AddMenuItem(godmodeButton); spieler.OnItemSelect += (_menu, _item, _index) => { int index = _index; switch (index) { case 0: // Heilen Game.PlayerPed.Health = Game.PlayerPed.MaxHealth; SendMessage("sevtixM - Freeroam", "Du wurdest geheilt", 0, 255, 0); break; case 1: // Fahndung entfernen Game.Player.WantedLevel = 0; SendMessage("sevtixM - Freeroam", "Dein Fahndungslevel wurde zurückgesetzt", 0, 255, 0); break; } }; // --------------------------------------------------------------------- Ped ped = Game.PlayerPed; Menu godmode = new Menu("sevtixM", "Godmode") { Visible = false }; MenuController.AddSubmenu(spieler, godmode); godmode.AddMenuItem(new MenuItem("An")); godmode.AddMenuItem(new MenuItem("Aus")); godmode.OnItemSelect += (_menu, _item, _index) => { int index = _index; switch (index) { case 0: // Heilen API.SetCurrentPedWeapon(ped.Handle, 2725352035, true); API.SetEntityInvincible(ped.Handle, true); //API.SetEnableHandcuffs(ped.Handle, true); API.SetPedCanSwitchWeapon(ped.Handle, false); API.SetPoliceIgnorePlayer(Game.Player.Handle, true); SendMessage("sevtixM - Freeroam", "Du bist nun Unverwundbar", 0, 255, 0); break; case 1: API.SetEntityInvincible(ped.Handle, false); //API.SetEnableHandcuffs(ped.Handle, false); API.SetPedCanSwitchWeapon(ped.Handle, true); API.SetPoliceIgnorePlayer(Game.Player.Handle, false); SendMessage("sevtixM - Freeroam", "Du bist nicht mehr Unverwundbar", 255, 0, 0); break; } }; // --------------------------------------------------------------------- Menu upgradesMenu = new Menu("sevtixM", "Upgrades") { Visible = false }; MenuController.AddSubmenu(fahrzeuge, upgradesMenu); List <string> engineUpgrades = new List <string>() { "Stock", "Level 1", "Level 2", "Level 3", "Level 4" }; MenuListItem engineItem = new MenuListItem("Motor", engineUpgrades, GetModIndexOfVehicleOr0(11)); upgradesMenu.AddMenuItem(engineItem); List <string> exhaustUpgrades = new List <string>() { "Stock", "Level 1", "Level 2", "Level 3", "Level 4" }; MenuListItem exhaust = new MenuListItem("Auspuff", exhaustUpgrades, GetModIndexOfVehicleOr0(4)); upgradesMenu.AddMenuItem(exhaust); upgradesMenu.OnListItemSelect += (_menu, _listItem, _listIndex, _itemIndex) => { int itemIndex = _itemIndex; int listIndex = _listIndex; switch (itemIndex) { case 0: // ENGINE if (Game.PlayerPed.IsInVehicle()) { Vehicle veh = Game.PlayerPed.CurrentVehicle; API.SetVehicleMod(veh.Handle, 11, listIndex - 1, false); } else { SendMessageNoVehicleMessage(); } break; case 4: // EXHAUST if (Game.PlayerPed.IsInVehicle()) { Vehicle veh = Game.PlayerPed.CurrentVehicle; API.SetVehicleMod(veh.Handle, 4, listIndex - 1, false); } else { SendMessageNoVehicleMessage(); } break; } }; // --------------------------------------------------------------------- Menu customfahrzeuge = new Menu("sevtixM", "Custom Fahrzeuge") { Visible = false }; MenuController.AddSubmenu(fahrzeuge, customfahrzeuge); customfahrzeuge.AddMenuItem(new MenuItem("KTM SX-F 450 Supermotard", "")); customfahrzeuge.AddMenuItem(new MenuItem("KTM EXC 530 Supermotard", "")); customfahrzeuge.AddMenuItem(new MenuItem("Toyota Supra", "")); customfahrzeuge.AddMenuItem(new MenuItem("Nissan Skyline GTR R34", "")); customfahrzeuge.AddMenuItem(new MenuItem("Nissan GTR R35", "")); customfahrzeuge.OnItemSelect += async(_menu, _item, _index) => { int index = _index; Vehicle spawned = null; switch (index) { case 0: spawned = await World.CreateVehicle(API.GetHashKey("sxf450sm"), Game.PlayerPed.Position); MenuController.CloseAllMenus(); break; case 1: spawned = await World.CreateVehicle(API.GetHashKey("exc530sm"), Game.PlayerPed.Position); MenuController.CloseAllMenus(); break; case 2: spawned = await World.CreateVehicle(API.GetHashKey("supra2"), Game.PlayerPed.Position); MenuController.CloseAllMenus(); break; case 3: spawned = await World.CreateVehicle(API.GetHashKey("skyline"), Game.PlayerPed.Position); MenuController.CloseAllMenus(); break; case 4: spawned = await World.CreateVehicle(API.GetHashKey("gtr"), Game.PlayerPed.Position); MenuController.CloseAllMenus(); break; } spawned.NeedsToBeHotwired = false; API.SetPedIntoVehicle(Game.PlayerPed.Handle, spawned.Handle, -1); }; // --------------------------------------------------------------------- MenuController.BindMenuItem(hauptmenu, fahrzeuge, fahrzeugeButton); MenuController.BindMenuItem(hauptmenu, spieler, spielerButton); MenuController.BindMenuItem(fahrzeuge, customfahrzeuge, customFahrzeugeButton); MenuController.BindMenuItem(fahrzeuge, upgradesMenu, upgradesButton); MenuController.BindMenuItem(spieler, godmode, godmodeButton); }
protected override void OnUpdate() { if ( !SceneManager.GetActiveScene().name.Equals("NavPerformanceDemo") && !SceneManager.GetActiveScene().name.Equals("NavMovingJumpDemo") ) { return; } var commandBuffer = barrier.CreateCommandBuffer().ToConcurrent(); var jumpableBufferFromEntity = GetBufferFromEntity <NavJumpableBufferElement>(true); var renderBoundsFromEntity = GetComponentDataFromEntity <RenderBounds>(true); var localToWorldFromEntity = GetComponentDataFromEntity <LocalToWorld>(true); var randomArray = World.GetExistingSystem <RandomSystem>().RandomArray; Entities .WithNone <NavNeedsDestination>() .WithReadOnly(jumpableBufferFromEntity) .WithReadOnly(renderBoundsFromEntity) .WithReadOnly(localToWorldFromEntity) .WithNativeDisableParallelForRestriction(randomArray) .ForEach((Entity entity, int entityInQueryIndex, int nativeThreadIndex, ref NavAgent agent, in Parent surface) => { if ( surface.Value.Equals(Entity.Null) || !jumpableBufferFromEntity.Exists(surface.Value) ) { return; } var jumpableSurfaces = jumpableBufferFromEntity[surface.Value]; var random = randomArray[nativeThreadIndex]; if (jumpableSurfaces.Length == 0) { // For the NavPerformanceDemo scene. commandBuffer.AddComponent(entityInQueryIndex, entity, new NavNeedsDestination { Destination = NavUtil.GetRandomPointInBounds( ref random, renderBoundsFromEntity[surface.Value].Value, 99 ) }); } else { // For the NavMovingJumpDemo scene. var destinationSurface = jumpableSurfaces[random.NextInt(0, jumpableSurfaces.Length)]; var localPoint = NavUtil.GetRandomPointInBounds( ref random, renderBoundsFromEntity[destinationSurface].Value, 3 ); var worldPoint = NavUtil.MultiplyPoint3x4( localToWorldFromEntity[destinationSurface.Value].Value, localPoint ); commandBuffer.AddComponent(entityInQueryIndex, entity, new NavNeedsDestination { Destination = worldPoint }); } randomArray[nativeThreadIndex] = random; }) .WithName("NavDestinationJob") .ScheduleParallel(); barrier.AddJobHandleForProducer(Dependency); }
public virtual Ship CreatePlayerShip(World world, Vector2 position, int shipID, float rotation, Vector2 velocity, string playerName, ShipStats shipStats, List <WeaponTypes> weaponTypes, HashSet <int> teams) { if (PlayerShip != null) { _teamManager.DeRegisterObject(PlayerShip); _targetManager.DeRegisterObject(PlayerShip); if (PlayerShip.IsBodyValid) { Debugging.DisposeStack.Push(this.ToString()); PlayerShip.Body.Dispose(); } } if (_shipList.ContainsKey(shipID)) { _positionUpdateList.Remove(_shipList[shipID]); _shipList.Remove(shipID); } Ship tempShip; switch (shipStats.ShipType) { case ShipTypes.Barge: tempShip = new Barge(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName, shipStats, _particleManager, world, _spriteBatch, GetTexture(shipStats.ShipType), teams); break; case ShipTypes.SuperCoolAwesome3DShip: tempShip = new SuperCoolAwesome3DShip(_spriteBatch, GetModel(shipStats.ShipType), position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName, shipStats, _particleManager, world, teams); break; case ShipTypes.Reaper: tempShip = new Reaper(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName, shipStats, _particleManager, world, _spriteBatch, GetTexture(shipStats.ShipType), teams); break; case ShipTypes.BattleCruiser: tempShip = new Battlecruiser(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName, shipStats, _particleManager, world, _spriteBatch, GetTexture(shipStats.ShipType), teams); break; case ShipTypes.Penguin: tempShip = new Penguin(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName, shipStats, _particleManager, world, _spriteBatch, GetTexture(shipStats.ShipType), teams); break; case ShipTypes.Dread: tempShip = new Dread(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName, shipStats, _particleManager, world, _spriteBatch, GetTexture(shipStats.ShipType), teams); break; default: Console.WriteLine("Ship type not implemented in ClientShipManager.CreatePlayerShip"); return(null); } byte slot = 0; foreach (var w in weaponTypes) { tempShip.SetWeapon(_createWeapon(tempShip, _projectileManager, w, slot), slot); slot++; } SetPilot(tempShip, Debugging.IsBot); _shipList.Add(tempShip.Id, tempShip); _positionUpdateList.Add(tempShip); _playerShipManager.PlayerShip = tempShip; _teamManager.RegisterObject(tempShip); _updateIgnoreList.Add(PlayerShip.Id); tempShip.CanLandWarp = true; return(tempShip); }
/// <summary> /// Used to create new network or NPC ships /// DO NOT USE FOR PLAYERSHIP /// ignorePositionUpdates should only be used by the Simulator /// </summary> public Ship CreateShip(World world, bool isNPC, Vector2 position, int shipID, float rotation, Vector2 velocity, string playerName, ShipStats shipStats, List <WeaponTypes> weaponTypes, HashSet <int> teams, bool ignorePositionUpdates = false) { Ship tempShip; _targetManager.DisableTargetSetting(); switch (shipStats.ShipType) { case ShipTypes.Barge: tempShip = new Barge(position, velocity, rotation, shipID, 0, playerName, shipStats, _particleManager, world, _spriteBatch, GetTexture(shipStats.ShipType), teams); tempShip.Pilot = new NetworkPilot(tempShip, new ShipBodyDataObject(BodyTypes.NetworkShip, shipID, tempShip)); break; case ShipTypes.Reaper: tempShip = new Reaper(position, velocity, rotation, shipID, 0, playerName, shipStats, _particleManager, world, _spriteBatch, GetTexture(shipStats.ShipType), teams); tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip)); break; case ShipTypes.SuperCoolAwesome3DShip: tempShip = new SuperCoolAwesome3DShip(_spriteBatch, GetModel(shipStats.ShipType), position, velocity, rotation, shipID, 0, playerName, shipStats, _particleManager, world, teams); tempShip.Pilot = new NetworkPilot(tempShip, new ShipBodyDataObject(BodyTypes.NetworkShip, shipID, tempShip)); break; case ShipTypes.BattleCruiser: tempShip = new Battlecruiser(position, velocity, rotation, shipID, 0, playerName, shipStats, _particleManager, world, _spriteBatch, GetTexture(shipStats.ShipType), teams); tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip)); break; case ShipTypes.Penguin: tempShip = new Penguin(position, velocity, rotation, shipID, 0, playerName, shipStats, _particleManager, world, _spriteBatch, GetTexture(shipStats.ShipType), teams); tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip)); break; case ShipTypes.Dread: tempShip = new Dread(position, velocity, rotation, shipID, 0, playerName, shipStats, _particleManager, world, _spriteBatch, GetTexture(shipStats.ShipType), teams); tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip)); break; default: ConsoleManager.WriteLine("Ship type not implemented in ClientShipManager.CreateShip", ConsoleMessageType.Error); return(null); } if (!_simulateNPCs || tempShip.Pilot.PilotType == PilotType.NetworkPlayer) { tempShip.BodyBehaviors.Add(new LerpBodyBehavior(_spriteBatch, _textureManager, tempShip, 100)); } tempShip.IsLocalSim = (_simulateNPCs && isNPC); AddShip(shipID, tempShip); byte numSet = 0; foreach (var t in weaponTypes) { tempShip.SetWeapon(_createWeapon(tempShip, _projectileManager, t, numSet), numSet); numSet++; } tempShip.Pilot = isNPC ? new NPCPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip)) : new NPCPilot(tempShip, new ShipBodyDataObject(BodyTypes.NetworkShip, shipID, tempShip)); if (ignorePositionUpdates) { _updateIgnoreList.Add(tempShip.Id); } _targetManager.EnableTargetSetting(); return(tempShip); }
internal override void update() { game_tick++; if (menu_traffic_light_changer.Checked && game_tick > 16) { game_tick = 0; Entity[] objs = World.GetNearbyEntities(playerPed.Position, 144f); for (int i = 0; i < objs.Length; i++) { /*if(TRAFFIC_LIGHTS.Any(h => h == objs[i].Model.Hash)) * { * Function.Call(Hash.SET_ENTITY_TRAFFICLIGHT_OVERRIDE, objs[i], menu_traffic_light_opts.Index); * break; * }*/ foreach (var h in TRAFFIC_LIGHTS) { if (h == objs[i].Model.Hash) { Function.Call(Hash.SET_ENTITY_TRAFFICLIGHT_OVERRIDE, objs[i], menu_traffic_light_opts.Index); break; } } } if (menu_traffic_ai_changer.Checked) { if (menu_traffic_light_opts.Index != 2) { Vehicle[] vehs = World.GetNearbyVehicles(playerPed.Position, 100f); for (int i = 0; i < vehs.Length; i++) { if (playerPed.CurrentVehicle == vehs[i]) { continue; } Vehicle veh = vehs[i]; Ped driver = veh.Driver; if (menu_traffic_light_opts.Index == 0) //green light, go { //drivers ignore if (veh.IsStoppedAtTrafficLights || veh.IsStopped) { driver.Task.ClearAll(); driver.DrivingStyle = DrivingStyle.IgnoreLights; } } else if (menu_traffic_light_opts.Index == 1) //red, stop now { if (!veh.IsStoppedAtTrafficLights || !veh.IsStopped) { driver.DrivingStyle = DrivingStyle.Normal; driver.Task.ClearAll(); driver.Task.ParkVehicle(veh, veh.Position, veh.Heading, 5, true); } } //veh.Driver.DrivingStyle = DrivingStyle.IgnoreLights; } } } } }
static int GetClipsCount_Internal(World world, Entity entity) { return(world.EntityManager.GetBuffer <TinyAnimationClipRef>(entity).Length); }
public static float GetDuration(World world, Entity entity, int clipIndex) => GetDurationAtIndex(world, entity, clipIndex);
public void PlaceBarrier() { for (var i = 0; i < barriers.Count; i++) { if (!LPlayer.LocalPlayer.Ped.IsInVehicle() && barriers[i].Exists()) { if (barriers[i].Position.DistanceTo(LPlayer.LocalPlayer.Ped.Position) < 1.7f) { foreach (Vehicle veh in World.GetVehicles(barriers[i].Position, 12f)) { if (veh.Exists() && !veh.isSeatFree(VehicleSeat.Driver) && veh.Model.Hash != 2452219115 && (long)veh.Model.Hash != 1171614426 && (long)veh.Model.Hash != 569305213) { veh.GetPedOnSeat(VehicleSeat.Driver).Task.CruiseWithVehicle(veh, 20f, true); veh.NoLongerNeeded(); } } foreach (Ped p in World.GetPeds(barriers[i].Position, 3f)) { if (p != LPlayer.LocalPlayer.Ped && !p.isInVehicle() && p.Model.Hash != 1136499716 && (long)p.Model.Hash != 3119890080) { //p.FreezePosition = false; p.Task.ClearAll(); p.Metadata.isBlocked = null; p.NoLongerNeeded(); } } barriers[i].NoLongerNeeded(); barriers[i].Delete(); barriers[i] = null; barriers.Remove(barriers[i]); return; } } } if (barriers.Count == 10) { Functions.PrintHelp("You've placed the maximum number of barriers"); } else { Vector3 spawnPos = LPlayer.LocalPlayer.Ped.GetOffsetPosition(new Vector3(0.0f, 1.2f, 0.0f)); Object barrier = World.CreateObject("CJ_BARRIER_2", spawnPos); barrier.Position = new Vector3(barrier.Position.X, barrier.Position.Y, World.GetGroundZ(barrier.Position)); barrier.Heading = LPlayer.LocalPlayer.Ped.Heading; barrier.FreezePosition = true; barriers.Add(barrier); } barrierTimer.Start(); }
public static void SelectClip(World world, Entity entity, uint clipHash) { AssertEntityIsValidAnimationPlayer(world, entity); SelectClip_Internal(world, entity, clipHash); }
static int GetCurrentClipIndex_Internal(World world, Entity entity) { return(world.EntityManager.GetComponentData <TinyAnimationPlayer>(entity).CurrentIndex); }
public static int GetClipsCount(World world, Entity entity) { AssertEntityIsValidAnimationPlayer(world, entity); return(GetClipsCount_Internal(world, entity)); }
public static void SelectClip(World world, Entity entity, int clipIndex) => SelectClipAtIndex(world, entity, clipIndex);
public override void Init(World owner) { WorldInstance = owner; var rand = new Random(); int x, y; do { x = rand.Next(0, owner.Map.Width); y = rand.Next(0, owner.Map.Height); } while (owner.Map[x, y].Region != TileRegion.Spawn); Move(x + 0.5f, y + 0.5f); tiles = new byte[owner.Map.Width, owner.Map.Height]; SetNewbiePeriod(); base.Init(owner); if (Client.Character.Pet != null) { GivePet(Client.Character.Pet); } if (owner.Id == World.NEXUS_ID || owner.Name == "Vault") { Client.SendPacket(new Global_NotificationPacket { Type = 0, Text = Client.Account.Gifts.Count > 0 ? "giftChestOccupied" : "giftChestEmpty" }); } SendAccountList(Locked, AccountListPacket.LOCKED_LIST_ID); SendAccountList(Ignored, AccountListPacket.IGNORED_LIST_ID); WorldTimer[] accTimer = { null }; owner.Timers.Add(accTimer[0] = new WorldTimer(5000, (w, t) => { Manager.Database.DoActionAsync(db => { if (Client?.Account == null) { return; } Client.Account = db.GetAccount(AccountId, Manager.GameData); Credits = Client.Account.Credits; CurrentFame = Client.Account.Stats.Fame; Tokens = Client.Account.FortuneTokens; accTimer[0].Reset(); Manager.Logic.AddPendingAction(_ => w.Timers.Add(accTimer[0]), PendingPriority.Creation); }); })); WorldTimer[] pingTimer = { null }; owner.Timers.Add(pingTimer[0] = new WorldTimer(PING_PERIOD, (w, t) => { Client.SendPacket(new PingPacket { Serial = pingSerial++ }); pingTimer[0].Reset(); Manager.Logic.AddPendingAction(_ => w.Timers.Add(pingTimer[0]), PendingPriority.Creation); })); Manager.Database.DoActionAsync(db => { db.UpdateLastSeen(Client.Account.AccountId, Client.Character.CharacterId, owner.Name); db.LockAccount(Client.Account); }); if (Client.Account.IsGuestAccount) { owner.Timers.Add(new WorldTimer(1000, (w, t) => Client.Disconnect())); Client.SendPacket(new networking.svrPackets.FailurePacket { ErrorId = 8, ErrorDescription = "Registration needed." }); Client.SendPacket(new PasswordPromtPacket { CleanPasswordStatus = PasswordPromtPacket.REGISTER }); return; } if (!Client.Account.VerifiedEmail && Program.Verify) { Client.SendPacket(new VerifyEmailDialogPacket()); owner.Timers.Add(new WorldTimer(1000, (w, t) => Client.Disconnect())); return; } CheckSetTypeSkin(); }
public static void SelectClip(World world, Entity entity, string clipName) { AssertEntityIsValidAnimationPlayer(world, entity); SelectClip_Internal(world, entity, StringToHash(clipName)); }
public Destroyer(World world) { _world = world; }
public static int GetCurrentClipIndex(World world, Entity entity) { AssertEntityIsValidAnimationPlayer(world, entity); return(GetCurrentClipIndex_Internal(world, entity)); }
protected abstract override string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi);
public DrTerrainRenderer(World world, DrTerrainRendererInfo info) { map = world.Map; this.info = info; }
public bool TryDoCommand(Players.Player player, string chat, List <string> splits) { if (!chat.Trim().ToLower().StartsWith("//wall") && !chat.Trim().ToLower().StartsWith("//walls")) { return(false); } if (!CommandHelper.CheckCommand(player)) { return(true); } if (0 >= splits.Count) { Chat.Send(player, "<color=orange>Wrong Arguments</color>"); return(true); } if (!CommandHelper.CheckLimit(player)) { return(true); } if (!CommandHelper.GetBlockIndex(player, splits[1], out ushort blockIndex)) { return(true); } ushort inner = BlockTypes.BuiltinBlocks.Indices.air; if (3 <= splits.Count) { if (!CommandHelper.GetBlockIndex(player, splits[2], out inner)) { return(true); } } AdvancedWand wand = AdvancedWand.GetAdvancedWand(player); Vector3Int start = wand.area.corner1; Vector3Int end = wand.area.corner2; for (int x = end.x; x >= start.x; x--) { for (int y = end.y; y >= start.y; y--) { for (int z = end.z; z >= start.z; z--) { if (x == start.x || x == end.x || z == start.z || z == end.z) { Vector3Int newPos = new Vector3Int(x, y, z); if (!World.TryGetTypeAt(newPos, out ushort actualType) || actualType != blockIndex) { AdvancedWand.AddAction(newPos, blockIndex, player); } } else if (inner != BlockTypes.BuiltinBlocks.Indices.air) { Vector3Int newPos = new Vector3Int(x, y, z); if (!World.TryGetTypeAt(newPos, out ushort actualType) || actualType != blockIndex) { AdvancedWand.AddAction(newPos, inner, player); } } } } } Chat.Send(player, string.Format("<color=lime>Wall: {0} {1}</color>", splits[1], inner)); return(true); }
protected override string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { mi.Button = MouseButton.Left; return(OrderInner(world, mi).Any() ? "powerdown" : "powerdown-blocked"); }
public ChooseBuildTabOnSelect(ActorInitializer init) { world = init.world; }
protected override IEnumerable <IRenderable> RenderAboveShroud(WorldRenderer wr, World world) { yield break; }
public void ProcessTick() { if (Started) { if (!GTA.Native.Function.Call <bool>(GTA.Native.Hash.IS_PLAYER_DEAD, Game.Player, true)) { //Attempt some spawning if the player is popping off rounds or the rando ticks if (rnd.Next(0, 3) == 1 || Game.Player.Character.IsShooting) { SPZombified(); } GTA.Native.Function.Call(GTA.Native.Hash.SET_MAX_WANTED_LEVEL, 0); //World.Weather=GTA.Weather.ThunderStorm; //F**k this weather // GTA.Native.Function.Call(GTA.Native.Hash.SET_PED_DENSITY_MULTIPLIER_THIS_FRAME, 99.0F); GTA.Native.Function.Call(GTA.Native.Hash.SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME, 0.0F); GTA.Native.Function.Call(GTA.Native.Hash.SET_RANDOM_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME, 0.0F); Ped[] nearByPeople = World.GetNearbyPeds(Game.Player.Character, 10000); for (int i = 0; i < nearByPeople.Length; i++) { //Vehicle V = World.GetClosestVehicle(Game.Player.Character.Position, 4000); //Ped DriverZ = V.GetPedOnSeat(VehicleSeat.Driver); //if (DriverZ != null && DriverZ.IsPlayer == false) //{ // Zombify(DriverZ); // //Get the 5 closest people by the driver we just zombied // Ped[] peopleByTheDriver = World.GetNearbyPeds(DriverZ, 500); // int MaxArrSize = peopleByTheDriver.Length; // if (MaxArrSize > 5) // { // MaxArrSize = 5; // } // for (int j = 0; j < MaxArrSize; j++) // { // Zombify(peopleByTheDriver[j]); // //if (peopleByTheDriver[j].IsPlayer == false) // //{ // // if (nearByPeople[i].Exists() && nearByPeople[i].IsAlive && !nearByPeople[i].IsRagdoll && !nearByPeople[i].IsGettingUp && nearByPeople[i].IsHuman // // && !GTA.Native.Function.Call<bool>(GTA.Native.Hash.IS_PED_IN_GROUP, nearByPeople[i]) // // ) // // { // // Zombify(peopleByTheDriver[j]); // // } // //} // _Wait(); // } //} if (nearByPeople[i].Exists() && nearByPeople[i].IsAlive && !nearByPeople[i].IsRagdoll && !nearByPeople[i].IsGettingUp && nearByPeople[i].IsHuman && !GTA.Native.Function.Call <bool>(GTA.Native.Hash.IS_PED_IN_GROUP, nearByPeople[i]) ) { if (World.GetDistance(Game.Player.Character.Position, nearByPeople[i].Position) < 1.2F && !Game.Player.Character.IsGettingUp && !Game.Player.Character.IsRagdoll // &&!Game.Player.Character.IsSittingInVehicle() // &&!GTA.Native.Function.Call<bool>(GTA.Native.Hash.IS_PED_ON_ANY_BIKE, Game.Player.Character) && !GTA.Native.Function.Call <bool>(GTA.Native.Hash.IS_PED_CLIMBING, nearByPeople[i]) && !GTA.Native.Function.Call <bool>(GTA.Native.Hash.IS_PED_FLEEING, nearByPeople[i]) ) { // GTA.Native.Function.Call(GTA.Native.Hash.TASK_CLIMB, nearByPeople[i],true); GTA.Native.Function.Call(GTA.Native.Hash.APPLY_DAMAGE_TO_PED, Game.Player.Character, 15); GTA.Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, Game.Player.Character, 1, 9000, 9000, 1, 1, 1); GTA.Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, nearByPeople[i], 1, 100, 100, 1, 1, 1); nearByPeople[i].ApplyForceRelative(new GTA.Math.Vector3(0, 1, 2)); Game.Player.Character.ApplyForceRelative(new GTA.Math.Vector3(0, -2, -10)); } Zombify(nearByPeople[i]); if (rnd.Next(0, 36) == 10 && nearByPeople[i].IsIdle && World.GetDistance(Game.Player.Character.Position, nearByPeople[i].Position) > 1.3F && !GTA.Native.Function.Call <bool>(GTA.Native.Hash.IS_PED_CLIMBING, nearByPeople[i]) ) { GTA.Native.Function.Call(GTA.Native.Hash.TASK_CLIMB, nearByPeople[i], true); nearByPeople[i].ApplyForceRelative(new GTA.Math.Vector3(0, 4, 4)); } Main._Wait(0); } } } else { Stop(); } } }
private void WarWarning_Callback() { World.Broadcast(0x22, true, "Server Wars in progress..."); }
protected override void OnCreate() { quandrantMultiHashMap = new NativeMultiHashMap <int, QuandrantData>(0, Allocator.Persistent); endSimulationEntityCommandBuffer = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>(); base.OnCreate(); }
private void OnSceneGUI() { HandleUtility.nearestControl = GUIUtility.GetControlID(FocusType.Passive); Ray ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); RaycastHit raycastHit; if (world.transform.hasChanged == true) { world.transform.localScale = new Vector3(world.transform.localScale.x, world.transform.localScale.x, world.transform.localScale.x); world.transform.localRotation = Quaternion.identity; world.Generate(); world.transform.hasChanged = false; } if (Event.current.type == EventType.MouseDown) { if (Event.current.button == 0) { leftButtonDown = true; } else if (Event.current.button == 1) { rightButtonDown = true; } else if (Event.current.button == 2) { middleButtonDown = true; } } else if (Event.current.type == EventType.MouseUp) { if (Event.current.button == 0) { leftButtonDown = false; } else if (Event.current.button == 1) { rightButtonDown = false; } else if (Event.current.button == 2) { middleButtonDown = false; } } if (world.editMode == true) { if ((Event.current.shift == false || world.terrainMode == World.TerrainMode.Line)) { // Brushes if (Physics.Raycast(ray, out raycastHit, 1000, LayerMask.GetMask("Chunk"))) { if (raycastHit.transform.GetComponent <Chunk>() != null) { World world = raycastHit.transform.parent.GetComponent <World>(); if (world.terrainMode == World.TerrainMode.Modify) { Handles.color = Color.white; if (world.alwaysFaceUpwards == true) { Handles.DrawWireDisc(raycastHit.point, Vector3.up, world.range); } else { Handles.DrawWireDisc(raycastHit.point, raycastHit.normal, world.range); } if ((leftButtonDown == true || rightButtonDown == true) && (Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseDrag)) { bool raise = true; if (rightButtonDown == true) { raise = false; } if (world.alwaysFaceUpwards == true) { TerrainEditor.ModifyTerrain(world, raycastHit.point, Vector3.up, raise); } else { TerrainEditor.ModifyTerrain(world, raycastHit.point, raycastHit.normal, raise); } } } else if (world.terrainMode == World.TerrainMode.Set) { Handles.color = Color.white; Handles.DrawWireDisc(raycastHit.point, Vector3.up, world.range); if (leftButtonDown == true && (Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseDrag)) { TerrainEditor.SetTerrain(world, raycastHit.point); } else if (middleButtonDown == true) { world.targetHeight = (raycastHit.point.y - raycastHit.transform.position.y) / world.transform.lossyScale.x + 0.5f; } } else if (world.terrainMode == World.TerrainMode.Line) { if (world.startPosition != new Vector3(float.MaxValue, float.MaxValue, float.MaxValue) && world.endPosition != new Vector3(float.MaxValue, float.MaxValue, float.MaxValue)) { Vector3 forward = world.startPosition - world.endPosition; Vector3 left = new Vector3(-forward.z, 0, forward.x).normalized; Handles.zTest = UnityEngine.Rendering.CompareFunction.Less; Handles.color = world.settings.FindProperty("linePreviewColour").colorValue; Handles.DrawLine(world.startPosition - left * world.range, world.endPosition - left * world.range / 2); Handles.DrawLine(world.startPosition + left * world.range, world.endPosition + left * world.range / 2); Handles.zTest = UnityEngine.Rendering.CompareFunction.Disabled; } if (Event.current.shift == false) { if (leftButtonDown == true) { world.startPosition = raycastHit.point; } else if (rightButtonDown == true) { world.endPosition = raycastHit.point; } } } else if (world.terrainMode == World.TerrainMode.Smooth) { Handles.color = Color.white; Handles.DrawWireDisc(raycastHit.point, (ray.origin - raycastHit.point).normalized, world.range); if (leftButtonDown == true) { TerrainEditor.SmoothTerrain(world, raycastHit.point, (ray.origin - raycastHit.point).normalized); } } else if (world.terrainMode == World.TerrainMode.Paint) { Handles.color = Color.white; Handles.DrawWireDisc(raycastHit.point, raycastHit.normal, world.range); if (leftButtonDown == true && (Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseDrag)) { TerrainEditor.PaintTerrain(world, raycastHit.point); } else if (middleButtonDown == true) { if (Event.current.control == true) { world.colourMask = raycastHit.transform.GetComponent <MeshFilter>().sharedMesh.colors[raycastHit.transform.GetComponent <MeshFilter>().sharedMesh.triangles[raycastHit.triangleIndex * 3]]; } else { world.colour = raycastHit.transform.GetComponent <MeshFilter>().sharedMesh.colors[raycastHit.transform.GetComponent <MeshFilter>().sharedMesh.triangles[raycastHit.triangleIndex * 3]]; } } } } } } } SceneView.currentDrawingSceneView.Repaint(); }
public LargeFernFlora(World world) : base(world, Material.Lilac) { }
private void ShutdownWarning_Callback() { World.Broadcast(0x22, true, "The server is going down shortly."); }