private static void OnDebugLOS(IZone zone, BeamType beamType, Position position, bool aligned) { if (!Debug) { return; } if (aligned) { zone.CreateAlignedDebugBeam(beamType, zone.FixZ(position)); return; } zone.CreateDebugBeam(beamType, position); }
public static void UpdateMissionStructure(IZone zone, long structureEid, int orientation = -1, Position position = new Position()) { var unit = zone.GetUnitOrThrow(structureEid); if (!position.Equals(default(Position))) { position = zone.FixZ(position); unit.CurrentPosition = position; var mstructure = unit as MissionStructure; if (mstructure != null) { MissionTarget.UpdatePositionByStructureEid(structureEid, position); } } if (orientation != -1) { unit.Orientation = (orientation % (byte.MaxValue + 1)) / (double)byte.MaxValue; } zone.UnitService.UpdateDefaultUnit(unit); }
public static void CreateAlignedDebugBeam(this IZone zone, BeamType beamType, Position position) { zone?.CreateBeam(beamType, builder => builder.WithPosition(zone.FixZ(position)).WithState(BeamState.AlignToTerrain).WithDuration(15000)); }
public static Player LoadPlayerAndAddToZone(IZone zone, Character character) { using (var scope = Db.CreateTransaction()) { var player = (Player)character.GetActiveRobot().ThrowIfNull(ErrorCodes.ARobotMustBeSelected); DockingBase dockingBase = null; ZoneEnterType zoneEnterType; Position spawnPosition; if (character.IsDocked) { // ha bazisrol jott zoneEnterType = ZoneEnterType.Undock; dockingBase = character.GetCurrentDockingBase(); spawnPosition = UndockSpawnPositionSelector.SelectSpawnPosition(dockingBase); character.ZoneId = zone.Id; character.ZonePosition = spawnPosition; character.IsDocked = false; } else { // ha teleportalt zoneEnterType = ZoneEnterType.Teleport; zone.Id.ThrowIfNotEqual(character.ZoneId ?? -1, ErrorCodes.InvalidZoneId); var zonePosition = character.ZonePosition.ThrowIfNull(ErrorCodes.InvalidPosition); spawnPosition = (Position)zonePosition; } spawnPosition = zone.FixZ(spawnPosition); // keresunk neki valami jo poziciot var finder = new ClosestWalkablePositionFinder(zone, spawnPosition, player); var validPosition = finder.FindOrThrow(); // parentoljuk a zonahoz <<< NAGYON FONTOS - TILOS MASHOGY kulonben bennmaradnak a (pbs) bazison a robotok, es pl letorlodnek amikor kilovik a bazist var zoneStorage = zone.Configuration.GetStorage(); player.Parent = zoneStorage.Eid; player.FullCoreRecharge(); // elmentjuk player.Save(); // csak akkor rakjuk ki ha volt rendes commit Transaction.Current.OnCommited(() => { dockingBase?.LeaveChannel(character); player.CorporationEid = character.CorporationEid; zone.SetGang(player); player.AddToZone(zone, validPosition, zoneEnterType); player.ApplyInvulnerableEffect(); }); scope.Complete(); return(player); } }