private void DoSummon(IZone zone) { Logger.Info("DoSummon starts on zone:" + zone.Id + " " + this); if (DeployerPlayer == null) { Logger.Error("no deployer player " + this); return; } var corporation = DeployerPlayer.Character.GetPrivateCorporation(); if (corporation == null) { Logger.Error("no private corporation was found. Deployer character: " + DeployerPlayer.Character); DeployerPlayer.Character.SendErrorMessage(new Command("pbsDeployItem"), ErrorCodes.PrivateCorporationAllowedOnly); return; } var centerTile = CurrentPosition.Center; PBSDockingBase dockingBase; using (var scope = Db.CreateTransaction()) { try { var deployableItem = (Unit)_entityServices.Factory.CreateWithRandomEID(TargetPBSNodeDefault); var zoneStorage = zone.Configuration.GetStorage(); zoneStorage.AddChild(deployableItem); SetStartCore(deployableItem); dockingBase = deployableItem as PBSDockingBase; if (dockingBase != null) { PBSHelper.CreatePBSDockingBase(dockingBase); } deployableItem.Owner = corporation.Eid; deployableItem.Orientation = FastRandom.NextInt(0, 3) * 0.25; deployableItem.CurrentPosition = CurrentPosition.Center; if (deployableItem is PBSTurret turret) { // csak a turret kell, gyerekek nem Repository.Insert(turret); } else { // itt mindent insertalunk deployableItem.Save(); } Logger.Info("node saved to sql " + deployableItem); Logger.Info("pbs insert start in zoneuser entities: " + deployableItem); zone.UnitService.AddUserUnit(deployableItem, centerTile); Logger.Info("pbs log starting " + deployableItem); PBSHelper.WritePBSLog(PBSLogType.deployed, deployableItem.Eid, deployableItem.Definition, deployableItem.Owner, DeployerPlayer.Character.Id, background: false, zoneId: zone.Id); Transaction.Current.OnCompleted((completed) => { if (!completed) { Logger.Error("DoSummon rollback " + this); return; } Logger.Info("starting zone enter: " + deployableItem); deployableItem.AddToZone(zone, centerTile); Logger.Info("added to zone " + deployableItem); dockingBase?.OnDockingBaseDeployed(); //draw terrain stuff PBSHelper.OnPBSObjectDeployed(zone, deployableItem, true, true, true); Logger.Info("terrain stuff done, sending update. " + deployableItem); //send update ((IPBSObject)deployableItem).SendNodeUpdate(); zone.CreateBeam(BeamType.red_20sec, builder => builder.WithPosition(CurrentPosition.Center) .WithState(BeamState.Hit) .WithDuration(15000)); Logger.Info("pbs node successfully deployed."); _successfulSummon = true; }); scope.Complete(); } catch (Exception ex) { Logger.Exception(ex); } } }