Фиксы апстрима

This commit is contained in:
Vigers Ray 2025-02-19 14:13:11 +03:00
parent ed0a30bb64
commit 8b0cadaf1e
9 changed files with 83 additions and 97 deletions

View file

@ -513,52 +513,52 @@ public sealed class ArrivalsSystem : EntitySystem
}
/// Sunrise-Edit
private void OnRoundStarting(RoundStartingEvent ev)
{
// Setup arrivals station
if (!Enabled)
return;
// private void OnRoundStarting(RoundStartingEvent ev)
// {
// // Setup arrivals station
// if (!Enabled)
// return;
//
// SetupArrivalsStation();
// }
SetupArrivalsStation();
}
private void SetupArrivalsStation()
{
var path = new ResPath(_cfgManager.GetCVar(CCVars.ArrivalsMap));
if (!_loader.TryLoadMap(path, out var map, out var grids))
return;
_metaData.SetEntityName(map.Value, Loc.GetString("map-name-terminal"));
foreach (var id in grids)
{
EnsureComp<ArrivalsSourceComponent>(id);
EnsureComp<ProtectedGridComponent>(id);
EnsureComp<PreventPilotComponent>(id);
}
// Setup planet arrivals if relevant
if (_cfgManager.GetCVar(CCVars.ArrivalsPlanet))
{
var template = _random.Pick(_arrivalsBiomeOptions);
_biomes.EnsurePlanet(map.Value, _protoManager.Index(template));
var restricted = new RestrictedRangeComponent
{
Range = 32f
};
AddComp(map.Value, restricted);
}
_mapSystem.InitializeMap(map.Value.Comp.MapId);
// Handle roundstart stations.
var query = AllEntityQuery<StationArrivalsComponent>();
while (query.MoveNext(out var uid, out var comp))
{
SetupShuttle(uid, comp);
}
}
// private void SetupArrivalsStation()
// {
// var path = new ResPath(_cfgManager.GetCVar(CCVars.ArrivalsMap));
// if (!_loader.TryLoadMap(path, out var map, out var grids))
// return;
//
// _metaData.SetEntityName(map.Value, Loc.GetString("map-name-terminal"));
//
// foreach (var id in grids)
// {
// EnsureComp<ArrivalsSourceComponent>(id);
// EnsureComp<ProtectedGridComponent>(id);
// EnsureComp<PreventPilotComponent>(id);
// }
//
// // Setup planet arrivals if relevant
// if (_cfgManager.GetCVar(CCVars.ArrivalsPlanet))
// {
// var template = _random.Pick(_arrivalsBiomeOptions);
// _biomes.EnsurePlanet(map.Value, _protoManager.Index(template));
// var restricted = new RestrictedRangeComponent
// {
// Range = 32f
// };
// AddComp(map.Value, restricted);
// }
//
// _mapSystem.InitializeMap(map.Value.Comp.MapId);
//
// // Handle roundstart stations.
// var query = AllEntityQuery<StationArrivalsComponent>();
//
// while (query.MoveNext(out var uid, out var comp))
// {
// SetupShuttle(uid, comp);
// }
// }
private void SetArrivals(bool obj)
{

View file

@ -55,6 +55,8 @@ using Content.Shared.Parallax;
using Content.Shared.Parallax.Biomes;
using Content.Shared.Salvage;
using Robust.Shared.Audio;
using Robust.Shared.EntitySerialization;
using Robust.Shared.Map;
namespace Content.Server.Shuttles.Systems;
@ -87,7 +89,6 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly MapLoaderSystem _loader = default!;
[Dependency] private readonly AtmosphereSystem _atmos = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
@ -576,7 +577,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
// Sunrise-start
var mapUid = _mapSystem.CreateMap(out var mapId, runMapInit: false);
if (!_loader.TryLoadGrid(mapId, component.Map.ToString(), out var uids) || uids.Count != 1)
if (!_loader.TryLoadGrid(mapId, component.Map, out var uid))
{
Log.Error($"Failed to set up transit hub map!");
QueueDel(mapUid);
@ -585,15 +586,15 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
EnsureComp<NightDayMapLightComponent>(mapUid);
Log.Info($"Created transit hub grid {ToPrettyString(uids[0])} on map {ToPrettyString(mapUid)} for station {ToPrettyString(station)}");
Log.Info($"Created transit hub grid {ToPrettyString(uid)} on map {ToPrettyString(mapUid)} for station {ToPrettyString(station)}");
EnsureComp<ProtectedGridComponent>(uids[0]);
EnsureComp<ProtectedGridComponent>(uid.Value.Owner);
// var template = _random.Pick(component.Biomes);
// _biomes.EnsurePlanet(mapUid, _protoManager.Index<BiomeTemplatePrototype>(template), mapLight: component.PlanetLightColor);
component.MapEntity = mapUid;
component.Entity = uids[0];
component.Entity = uid;
var moles = new float[Atmospherics.AdjustedNumberOfGases];
moles[(int) Gas.Oxygen] = 21.824779f;
@ -678,22 +679,20 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
// Sunrise-start
var mapId = _mapManager.CreateMap();
var mapOptions = new MapLoadOptions { LoadMap = false,};
if (!_loader.TryLoadGrid(mapId, shuttlePath.ToString(), out var uids, mapOptions) || uids.Count != 1)
var mapOptions = new DeserializationOptions {};
if (!_loader.TryLoadGrid(mapId, shuttlePath, out var shuttle, mapOptions))
{
Log.Error($"Unable to spawn emergency shuttle {shuttlePath} for {ToPrettyString(ent)}");
return;
}
var shuttle = uids[0];
ent.Comp1.EmergencyShuttle = shuttle;
EnsureComp<ProtectedGridComponent>(shuttle);
EnsureComp<PreventPilotComponent>(shuttle);
EnsureComp<EmergencyShuttleComponent>(shuttle);
EnsureComp<ProtectedGridComponent>(shuttle.Value.Owner);
EnsureComp<PreventPilotComponent>(shuttle.Value.Owner);
EnsureComp<EmergencyShuttleComponent>(shuttle.Value.Owner);
var docks = new HashSet<Entity<DockingComponent>>();
_lookup.GetChildEntities(shuttle, docks);
_lookup.GetChildEntities(shuttle.Value.Owner, docks);
foreach (var dock in docks)
{
var airlock = EnsureComp<AirlockComponent>(dock);

View file

@ -95,8 +95,10 @@ namespace Content.Server.Storage.EntitySystems
}
if (entityToPlaceInHands != null)
{
_hands.PickupOrDrop(args.User, entityToPlaceInHands.Value);
_audio.PlayPvs(component.Sound, entityToPlaceInHands.Value); // Sunrise-edit
}
args.Handled = true;

View file

@ -101,7 +101,7 @@ public sealed partial class GunSystem
throw new ArgumentOutOfRangeException();
}
_damageExamine.AddDamageExamine(args.Message, Damageable.ApplyUniversalAllModifiers(damageSpec), shotCount, shootModifier, damageType);
_damageExamine.AddDamageExamineWithModifier(args.Message, Damageable.ApplyUniversalAllModifiers(damageSpec), shotCount, shootModifier, damageType);
}
private DamageSpecifier? GetDamage(BatteryAmmoProviderComponent component)

View file

@ -80,7 +80,7 @@ public sealed partial class GunSystem
shootModifier = ShootModifier.Spread;
}
_damageExamine.AddDamageExamine(args.Message, Damageable.ApplyUniversalAllModifiers(damageSpec), shotCount, shootModifier, Loc.GetString("damage-projectile"));
_damageExamine.AddDamageExamineWithModifier(args.Message, Damageable.ApplyUniversalAllModifiers(damageSpec), shotCount, shootModifier, Loc.GetString("damage-projectile"));
}
private DamageSpecifier? GetProjectileDamage(string proto)

View file

@ -13,8 +13,8 @@ using Content.Shared.Parallax.Biomes;
using Content.Shared.Salvage;
using Content.Shared.Shuttles.Components;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.Configuration;
using Robust.Shared.EntitySerialization;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
@ -90,17 +90,8 @@ public sealed class PlanetPrisonStationSystem : EntitySystem
return;
}
var mapUid = _map.CreateMap();
var xform = Transform(mapUid);
component.MapId = xform.MapID;
var station = _random.Pick(component.Stations);
var mapOptions = new MapLoadOptions()
{
LoadMap = false,
Rotation = Angle.Zero,
};
if (!_protoManager.TryIndex<BiomeTemplatePrototype>(_random.Pick(component.Biomes), out var biome))
{
_sawmill.Warning("No Prison map found, skipping setup.");
@ -116,7 +107,7 @@ public sealed class PlanetPrisonStationSystem : EntitySystem
_chat.DispatchServerAnnouncement(Loc.GetString("planet-prison-select-map", ("stationName", gameMap.MapName)), Color.LightBlue);
_chat.DispatchServerAnnouncement(Loc.GetString("planet-prison-select-biome", ("biomeName", biome.ID)), Color.LightBlue);
var uids = _gameTicker.LoadGameMap(gameMap, xform.MapID, mapOptions);
var uids = _gameTicker.LoadGameMap(gameMap, out var mapId, rot: Angle.Zero);
if (uids.Count != 1)
{
@ -134,6 +125,7 @@ public sealed class PlanetPrisonStationSystem : EntitySystem
EnsureComp<IgnoreFtlCheckComponent>(uids[0]);
component.PrisonGrid = uids[0];
var mapUid = _mapManager.GetMapEntityId(mapId);
_biomeSystem.EnsurePlanet(mapUid, biome);
// Sunrise-Start

View file

@ -2,7 +2,7 @@
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Systems;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.EntitySerialization.Systems;
using Robust.Shared.Map;
using Robust.Shared.Physics.Components;
@ -29,23 +29,19 @@ public sealed class RoundStartFtlSystem : EntitySystem
var ftlMap = _shuttles.EnsureFTLMap();
var xformMap = Transform(ftlMap);
if (!_loader.TryLoad(xformMap.MapID,
ftlTargetComponent.GridPath.Value.ToString(),
out var rootUids,
new MapLoadOptions()
{
Offset = new Vector2(500, 500),
DoMapInit = true,
}))
if (!_loader.TryLoadGrid(xformMap.MapID,
ftlTargetComponent.GridPath.Value,
out var rootUid,
offset: new Vector2(500, 500)))
return;
if (!TryComp<ShuttleComponent>(rootUids[0], out var shuttleComp))
if (!TryComp<ShuttleComponent>(rootUid.Value.Owner, out var shuttleComp))
return;
var xform = Transform(targetUid);
if (!TryComp(rootUids[0], out PhysicsComponent? shuttlePhysics))
if (!TryComp(rootUid.Value.Owner, out PhysicsComponent? shuttlePhysics))
return;
var targetCoordinates = new EntityCoordinates(xform.MapUid!.Value, _transform.GetWorldPosition(xform)).Offset(Angle.Zero.RotateVec(-shuttlePhysics.LocalCenter));
_shuttles.FTLToCoordinates(rootUids[0], shuttleComp, targetCoordinates, Angle.Zero, 0, 0);
Log.Debug($"onmapinit, ftlsuccessful: {rootUids[0]}, {targetCoordinates}");
_shuttles.FTLToCoordinates(rootUid.Value.Owner, shuttleComp, targetCoordinates, Angle.Zero, 0, 0);
Log.Debug($"onmapinit, ftlsuccessful: {rootUid.Value.Owner}, {targetCoordinates}");
}
}

View file

@ -10,7 +10,8 @@ using Content.Server.Station.Events;
using Content.Server.Station.Systems;
using Content.Shared.Shuttles.Components;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.EntitySerialization;
using Robust.Shared.EntitySerialization.Systems;
using Robust.Shared.Map;
using Robust.Shared.Utility;
@ -38,14 +39,14 @@ public sealed class CodeEquipmentSystem : EntitySystem
private void OnStationPostInit(EntityUid uid, CodeEquipmentComponent comp, StationPostInitEvent ev)
{
var map = _mapManager.CreateMap();
var loadOptions = new MapLoadOptions();
loadOptions.LoadMap = true;
loadOptions.StoreMapUids = true;
_loader.TryLoad(map, comp.ShuttlePath.ToString(), out var shuttleUids, loadOptions);
if (shuttleUids is null)
var loadOptions = new DeserializationOptions();
loadOptions.InitializeMaps = true;
loadOptions.StoreYamlUids = true;
_loader.TryLoadGrid(map, comp.ShuttlePath, out var shuttleUid, loadOptions);
if (shuttleUid is null)
return;
comp.Shuttles.Add(shuttleUids[0]);
var gammaArmoryComp = EnsureComp<CodeEquipmentShuttleComponent>(shuttleUids[0]);
comp.Shuttles.Add(shuttleUid.Value.Owner);
var gammaArmoryComp = EnsureComp<CodeEquipmentShuttleComponent>(shuttleUid.Value.Owner);
gammaArmoryComp.Station = uid;
}

View file

@ -3,7 +3,6 @@ using Content.Server.GameTicking;
using Content.Server.Maps;
using Content.Server.Shuttles.Systems;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
@ -62,14 +61,11 @@ public sealed partial class StationCentCommSystem : EntitySystem
return;
}
var mapId = _mapManager.CreateMap();
_mapManager.AddUninitializedMap(mapId);
component.MapId = mapId;
if (component.Station != null)
{
if (_prototypeManager.TryIndex<GameMapPrototype>(component.Station, out var gameMap))
{
_gameTicker.LoadGameMap(gameMap, mapId, null);
_gameTicker.LoadGameMap(gameMap, out var mapId);
if (_shuttle.TryAddFTLDestination(mapId, true, out var ftlDestination))
ftlDestination.Whitelist = component.ShuttleWhitelist;