Merge remote-tracking branch 'refs/remotes/wizards/master'

# Conflicts:
#	Tools/gen_build_info.py
This commit is contained in:
VigersRay 2024-07-14 12:24:06 +03:00
commit 5aaf638614
45 changed files with 304 additions and 293 deletions

View file

@ -42,31 +42,22 @@ jobs:
- name: Package client
run: dotnet run --project Content.Packaging client --no-wipe-release
- name: Update Build Info
run: Tools/gen_build_info.py
- name: Shuffle files around
run: |
mkdir "release/${{ github.sha }}"
mv release/*.zip "release/${{ github.sha }}"
- name: Upload files to centcomm
uses: appleboy/scp-action@master
- name: Upload build artifact
id: artifact-upload-step
uses: actions/upload-artifact@v4
with:
host: centcomm.spacestation14.io
username: wizards-build-push
key: ${{ secrets.CENTCOMM_WIZARDS_BUILDS_PUSH_KEY }}
source: "release/${{ github.sha }}"
target: "/home/wizards-build-push/builds_dir/builds/"
strip_components: 1
name: build
path: release/*.zip
compression-level: 0
retention-days: 0
- name: Update manifest JSON
uses: appleboy/ssh-action@master
with:
host: centcomm.spacestation14.io
username: wizards-build-push
key: ${{ secrets.CENTCOMM_WIZARDS_BUILDS_PUSH_KEY }}
script: /home/wizards-build-push/push.ps1 ${{ github.sha }}
- name: Publish version
run: Tools/publish_github_artifact.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
ARTIFACT_ID: ${{ steps.artifact-upload-step.outputs.artifact-id }}
GITHUB_REPOSITORY: ${{ vars.GITHUB_REPOSITORY }}
- name: Publish changelog (Discord)
run: Tools/actions_changelogs_since_last_run.py
@ -78,3 +69,8 @@ jobs:
run: Tools/actions_changelog_rss.py
env:
CHANGELOG_RSS_KEY: ${{ secrets.CHANGELOG_RSS_KEY }}
- uses: geekyeggo/delete-artifact@v5
if: always()
with:
name: build

View file

@ -64,11 +64,3 @@ jobs:
- name: Package client
run: dotnet run --project Content.Packaging client --no-wipe-release
- name: Update Build Info
run: Tools/gen_build_info.py
- name: Shuffle files around
run: |
mkdir "release/${{ github.sha }}"
mv release/*.zip "release/${{ github.sha }}"

View file

@ -48,11 +48,11 @@ namespace Content.Client.Construction
CommandBinds.Builder
.Bind(ContentKeyFunctions.OpenCraftingMenu,
new PointerInputCmdHandler(HandleOpenCraftingMenu, outsidePrediction:true))
new PointerInputCmdHandler(HandleOpenCraftingMenu, outsidePrediction: true))
.Bind(EngineKeyFunctions.Use,
new PointerInputCmdHandler(HandleUse, outsidePrediction: true))
.Bind(ContentKeyFunctions.EditorFlipObject,
new PointerInputCmdHandler(HandleFlip, outsidePrediction:true))
new PointerInputCmdHandler(HandleFlip, outsidePrediction: true))
.Register<ConstructionSystem>();
SubscribeLocalEvent<ConstructionGhostComponent, ExaminedEvent>(HandleConstructionGhostExamined);
@ -196,7 +196,7 @@ namespace Content.Client.Construction
if (GhostPresent(loc))
return false;
var predicate = GetPredicate(prototype.CanBuildInImpassable, loc.ToMap(EntityManager, _transformSystem));
var predicate = GetPredicate(prototype.CanBuildInImpassable, _transformSystem.ToMapCoordinates(loc));
if (!_examineSystem.InRangeUnOccluded(user, loc, 20f, predicate: predicate))
return false;

View file

@ -170,7 +170,7 @@ namespace Content.Client.ContextMenu.UI
if (_combatMode.IsInCombatMode(args.Session?.AttachedEntity))
return false;
var coords = args.Coordinates.ToMap(_entityManager, _xform);
var coords = _xform.ToMapCoordinates(args.Coordinates);
if (_verbSystem.TryGetEntityMenuEntities(coords, out var entities))
OpenRootMenu(entities);

View file

@ -104,7 +104,8 @@ namespace Content.Client.Gameplay
public IEnumerable<EntityUid> GetClickableEntities(EntityCoordinates coordinates)
{
return GetClickableEntities(coordinates.ToMap(_entityManager, _entitySystemManager.GetEntitySystem<SharedTransformSystem>()));
var transformSystem = _entitySystemManager.GetEntitySystem<SharedTransformSystem>();
return GetClickableEntities(transformSystem.ToMapCoordinates(coordinates));
}
public IEnumerable<EntityUid> GetClickableEntities(MapCoordinates coordinates)

View file

@ -25,6 +25,9 @@ namespace Content.Client.MainMenu
[Dependency] private readonly IGameController _controllerProxy = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly ILogManager _logManager = default!;
private ISawmill _sawmill = default!;
private MainMenuControl _mainMenuControl = default!;
private bool _isConnecting;
@ -35,6 +38,8 @@ namespace Content.Client.MainMenu
/// <inheritdoc />
protected override void Startup()
{
_sawmill = _logManager.GetSawmill("mainmenu");
_mainMenuControl = new MainMenuControl(_resourceCache, _configurationManager);
_userInterfaceManager.StateRoot.AddChild(_mainMenuControl);
@ -116,7 +121,7 @@ namespace Content.Client.MainMenu
catch (ArgumentException e)
{
_userInterfaceManager.Popup($"Unable to connect: {e.Message}", "Connection error.");
Logger.Warning(e.ToString());
_sawmill.Warning(e.ToString());
_netManager.ConnectFailed -= _onConnectFailed;
_setConnectingState(false);
}

View file

@ -15,6 +15,7 @@ public sealed class JetpackSystem : SharedJetpackSystem
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly ClothingSystem _clothing = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
public override void Initialize()
{
@ -73,11 +74,11 @@ public sealed class JetpackSystem : SharedJetpackSystem
var uidXform = Transform(uid);
var coordinates = uidXform.Coordinates;
var gridUid = coordinates.GetGridUid(EntityManager);
var gridUid = _transform.GetGrid(coordinates);
if (TryComp<MapGridComponent>(gridUid, out var grid))
{
coordinates = new EntityCoordinates(gridUid.Value, grid.WorldToLocal(coordinates.ToMapPos(EntityManager, _transform)));
coordinates = new EntityCoordinates(gridUid.Value, _mapSystem.WorldToLocal(gridUid.Value, grid, _transform.ToMapCoordinates(coordinates).Position));
}
else if (uidXform.MapUid != null)
{

View file

@ -203,7 +203,7 @@ namespace Content.Client.NPC
if (found || !_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) || !xformQuery.TryGetComponent(grid, out var gridXform))
continue;
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
var localAABB = invWorldMatrix.TransformBox(aabb.Enlarged(float.Epsilon - SharedPathfindingSystem.ChunkSize));
foreach (var chunk in crumbs)
@ -287,7 +287,7 @@ namespace Content.Client.NPC
return;
}
var invGridMatrix = gridXform.InvWorldMatrix;
var invGridMatrix = _transformSystem.GetInvWorldMatrix(gridXform);
DebugPathPoly? nearest = null;
foreach (var poly in tile)
@ -359,7 +359,7 @@ namespace Content.Client.NPC
continue;
}
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
worldHandle.SetTransform(worldMatrix);
var localAABB = invWorldMatrix.TransformBox(aabb);
@ -419,7 +419,7 @@ namespace Content.Client.NPC
!xformQuery.TryGetComponent(grid, out var gridXform))
continue;
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
worldHandle.SetTransform(worldMatrix);
var localAABB = invWorldMatrix.TransformBox(aabb);
@ -458,7 +458,7 @@ namespace Content.Client.NPC
!xformQuery.TryGetComponent(grid, out var gridXform))
continue;
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
var (_, _, worldMatrix, invMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
worldHandle.SetTransform(worldMatrix);
var localAABB = invMatrix.TransformBox(aabb);
@ -483,7 +483,7 @@ namespace Content.Client.NPC
if (neighborPoly.NetEntity != poly.GraphUid)
{
color = Color.Green;
var neighborMap = _entManager.GetCoordinates(neighborPoly).ToMap(_entManager, _transformSystem);
var neighborMap = _transformSystem.ToMapCoordinates(_entManager.GetCoordinates(neighborPoly));
if (neighborMap.MapId != args.MapId)
continue;
@ -517,7 +517,7 @@ namespace Content.Client.NPC
!xformQuery.TryGetComponent(grid, out var gridXform))
continue;
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
worldHandle.SetTransform(worldMatrix);
var localAABB = invWorldMatrix.TransformBox(args.WorldBounds);
@ -544,7 +544,7 @@ namespace Content.Client.NPC
if (!_entManager.TryGetComponent<TransformComponent>(_entManager.GetEntity(node.GraphUid), out var graphXform))
continue;
worldHandle.SetTransform(graphXform.WorldMatrix);
worldHandle.SetTransform(_transformSystem.GetWorldMatrix(graphXform));
worldHandle.DrawRect(node.Box, Color.Orange.WithAlpha(0.10f));
}
}
@ -568,7 +568,7 @@ namespace Content.Client.NPC
continue;
matrix = graph;
worldHandle.SetTransform(graphXform.WorldMatrix);
worldHandle.SetTransform(_transformSystem.GetWorldMatrix(graphXform));
}
worldHandle.DrawRect(node.Box, new Color(0f, cost / highestGScore, 1f - (cost / highestGScore), 0.10f));

View file

@ -58,8 +58,8 @@ public sealed class JointVisualsOverlay : Overlay
coordsA = coordsA.Offset(rotA.RotateVec(visuals.OffsetA));
coordsB = coordsB.Offset(rotB.RotateVec(visuals.OffsetB));
var posA = coordsA.ToMapPos(_entManager, xformSystem);
var posB = coordsB.ToMapPos(_entManager, xformSystem);
var posA = xformSystem.ToMapCoordinates(coordsA).Position;
var posB = xformSystem.ToMapCoordinates(coordsB).Position;
var diff = (posB - posA);
var length = diff.Length();

View file

@ -228,8 +228,8 @@ public partial class NavMapControl : MapGridControl
{
if (!blip.Selectable)
continue;
var currentDistance = (blip.Coordinates.ToMapPos(EntManager, _transformSystem) - worldPosition).Length();
var currentDistance = (_transformSystem.ToMapCoordinates(blip.Coordinates).Position - worldPosition).Length();
if (closestDistance < currentDistance || currentDistance * MinimapScale > MaxSelectableDistance)
continue;
@ -397,7 +397,7 @@ public partial class NavMapControl : MapGridControl
{
if (lit && value.Visible)
{
var mapPos = coord.ToMap(EntManager, _transformSystem);
var mapPos = _transformSystem.ToMapCoordinates(coord);
if (mapPos.MapId != MapId.Nullspace)
{
@ -418,7 +418,7 @@ public partial class NavMapControl : MapGridControl
if (blip.Texture == null)
continue;
var mapPos = blip.Coordinates.ToMap(EntManager, _transformSystem);
var mapPos = _transformSystem.ToMapCoordinates(blip.Coordinates);
if (mapPos.MapId != MapId.Nullspace)
{
@ -535,7 +535,7 @@ public partial class NavMapControl : MapGridControl
// East edge
neighborData = 0;
if (relativeTile.X != SharedNavMapSystem.ChunkSize - 1)
neighborData = chunk.TileData[i+SharedNavMapSystem.ChunkSize];
neighborData = chunk.TileData[i + SharedNavMapSystem.ChunkSize];
else if (_navMap.Chunks.TryGetValue(chunkOrigin + Vector2i.Right, out neighborChunk))
neighborData = neighborChunk.TileData[i + SharedNavMapSystem.ChunkSize - SharedNavMapSystem.ArraySize];
@ -548,7 +548,7 @@ public partial class NavMapControl : MapGridControl
// South edge
neighborData = 0;
if (relativeTile.Y != 0)
neighborData = chunk.TileData[i-1];
neighborData = chunk.TileData[i - 1];
else if (_navMap.Chunks.TryGetValue(chunkOrigin + Vector2i.Down, out neighborChunk))
neighborData = neighborChunk.TileData[i - 1 + SharedNavMapSystem.ChunkSize];
@ -561,7 +561,7 @@ public partial class NavMapControl : MapGridControl
// West edge
neighborData = 0;
if (relativeTile.X != 0)
neighborData = chunk.TileData[i-SharedNavMapSystem.ChunkSize];
neighborData = chunk.TileData[i - SharedNavMapSystem.ChunkSize];
else if (_navMap.Chunks.TryGetValue(chunkOrigin + Vector2i.Left, out neighborChunk))
neighborData = neighborChunk.TileData[i - SharedNavMapSystem.ChunkSize + SharedNavMapSystem.ArraySize];

View file

@ -45,7 +45,7 @@ public sealed class AlignRCDConstruction : PlacementMode
_unalignedMouseCoords = ScreenToCursorGrid(mouseScreen);
MouseCoords = _unalignedMouseCoords.AlignWithClosestGridTile(SearchBoxSize, _entityManager, _mapManager);
var gridId = MouseCoords.GetGridUid(_entityManager);
var gridId = _transformSystem.GetGrid(MouseCoords);
if (!_entityManager.TryGetComponent<MapGridComponent>(gridId, out var mapGrid))
return;
@ -75,7 +75,7 @@ public sealed class AlignRCDConstruction : PlacementMode
if (!_entityManager.TryGetComponent<TransformComponent>(player, out var xform))
return false;
if (!xform.Coordinates.InRange(_entityManager, _transformSystem, position, SharedInteractionSystem.InteractionRange))
if (!_transformSystem.InRange(xform.Coordinates, position, SharedInteractionSystem.InteractionRange))
{
InvalidPlaceColor = InvalidPlaceColor.WithAlpha(0);
return false;
@ -105,8 +105,8 @@ public sealed class AlignRCDConstruction : PlacementMode
if (currentState is not GameplayStateBase screen)
return false;
var target = screen.GetClickedEntity(_unalignedMouseCoords.ToMap(_entityManager, _transformSystem));
var target = screen.GetClickedEntity(_transformSystem.ToMapCoordinates(_unalignedMouseCoords));
// Determine if the RCD operation is valid or not
if (!_rcdSystem.IsRCDOperationStillValid(heldEntity.Value, rcd, mapGridData.Value, target, player.Value, false))

View file

@ -116,7 +116,9 @@ namespace Content.Client.Radiation.Overlays
var shaderInstance = _pulses[pulseEntity];
shaderInstance.instance.CurrentMapCoords = _transform.GetMapCoordinates(pulseEntity);
shaderInstance.instance.Range = pulse.VisualRange;
} else {
}
else
{
_pulses[pulseEntity].shd.Dispose();
_pulses.Remove(pulseEntity);
}
@ -129,7 +131,7 @@ namespace Content.Client.Radiation.Overlays
var transformComponent = _entityManager.GetComponent<TransformComponent>(pulseEntity);
var transformSystem = _entityManager.System<SharedTransformSystem>();
return transformComponent.MapID == currentEyeLoc.MapId
&& transformComponent.Coordinates.InRange(_entityManager, transformSystem, EntityCoordinates.FromMap(transformComponent.ParentUid, currentEyeLoc, transformSystem, _entityManager), MaxDist);
&& transformSystem.InRange(transformComponent.Coordinates, transformSystem.ToCoordinates(transformComponent.ParentUid, currentEyeLoc), MaxDist);
}
private sealed record RadiationShaderInstance(MapCoordinates CurrentMapCoords, float Range, TimeSpan Start, float Duration)

View file

@ -17,6 +17,7 @@ namespace Content.Client.Sandbox
[Dependency] private readonly IPlacementManager _placement = default!;
[Dependency] private readonly ContentEyeSystem _contentEye = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
private bool _sandboxEnabled;
public bool SandboxAllowed { get; private set; }
@ -92,7 +93,7 @@ namespace Content.Client.Sandbox
&& EntityManager.TryGetComponent(uid, out MetaDataComponent? comp)
&& !comp.EntityDeleted)
{
if (comp.EntityPrototype == null || comp.EntityPrototype.NoSpawn || comp.EntityPrototype.Abstract)
if (comp.EntityPrototype == null || comp.EntityPrototype.HideSpawnMenu || comp.EntityPrototype.Abstract)
return false;
if (_placement.Eraser)
@ -109,7 +110,8 @@ namespace Content.Client.Sandbox
}
// Try copy tile.
if (!_map.TryFindGridAt(coords.ToMap(EntityManager, _transform), out _, out var grid) || !grid.TryGetTileRef(coords, out var tileRef))
if (!_map.TryFindGridAt(_transform.ToMapCoordinates(coords), out var gridUid, out var grid) || !_mapSystem.TryGetTileRef(gridUid, grid, coords, out var tileRef))
return false;
if (_placement.Eraser)

View file

@ -35,9 +35,9 @@ public sealed partial class ShuttleSystem
switch (mapObj)
{
case ShuttleBeaconObject beacon:
return GetCoordinates(beacon.Coordinates).ToMap(EntityManager, XformSystem);
return XformSystem.ToMapCoordinates(GetCoordinates(beacon.Coordinates));
case ShuttleExclusionObject exclusion:
return GetCoordinates(exclusion.Coordinates).ToMap(EntityManager, XformSystem);
return XformSystem.ToMapCoordinates(GetCoordinates(exclusion.Coordinates));
case GridMapObject grid:
var gridXform = Transform(grid.Entity);

View file

@ -519,7 +519,7 @@ public sealed partial class ShuttleMapControl : BaseShuttleControl
if (mapO is not ShuttleBeaconObject beacon)
continue;
var beaconCoords = EntManager.GetCoordinates(beacon.Coordinates).ToMap(EntManager, _xformSystem);
var beaconCoords = _xformSystem.ToMapCoordinates(EntManager.GetCoordinates(beacon.Coordinates));
var position = Vector2.Transform(beaconCoords.Position, mapTransform);
var localPos = ScalePosition(position with {Y = -position.Y});

View file

@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using System.Numerics;
using Content.Client.Animations;
using Content.Shared.Hands;
@ -142,14 +142,14 @@ public sealed class StorageSystem : SharedStorageSystem
{
if (!_timing.IsFirstTimePredicted)
return;
if (finalCoords.InRange(EntityManager, TransformSystem, initialCoords, 0.1f) ||
if (TransformSystem.InRange(finalCoords, initialCoords, 0.1f) ||
!Exists(initialCoords.EntityId) || !Exists(finalCoords.EntityId))
{
return;
}
var finalMapPos = finalCoords.ToMapPos(EntityManager, TransformSystem);
var finalMapPos = TransformSystem.ToMapCoordinates(finalCoords).Position;
var finalPos = Vector2.Transform(finalMapPos, TransformSystem.GetInvWorldMatrix(initialCoords.EntityId));
_entityPickupAnimation.AnimateEntityPickup(item, initialCoords, finalPos, initialAngle);

View file

@ -220,7 +220,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
return;
}
var targetMap = coordinates.ToMap(EntityManager, TransformSystem);
var targetMap = TransformSystem.ToMapCoordinates(coordinates);
if (targetMap.MapId != userXform.MapID)
return;

View file

@ -176,7 +176,7 @@ public sealed partial class GunSystem : SharedGunSystem
}
// Define target coordinates relative to gun entity, so that network latency on moving grids doesn't fuck up the target location.
var coordinates = EntityCoordinates.FromMap(entity, mousePos, TransformSystem, EntityManager);
var coordinates = TransformSystem.ToCoordinates(entity, mousePos);
NetEntity? target = null;
if (_state.CurrentState is GameplayStateBase screen)
@ -200,7 +200,7 @@ public sealed partial class GunSystem : SharedGunSystem
// Rather than splitting client / server for every ammo provider it's easier
// to just delete the spawned entities. This is for programmer sanity despite the wasted perf.
// This also means any ammo specific stuff can be grabbed as necessary.
var direction = fromCoordinates.ToMapPos(EntityManager, TransformSystem) - toCoordinates.ToMapPos(EntityManager, TransformSystem);
var direction = TransformSystem.ToMapCoordinates(fromCoordinates).Position - TransformSystem.ToMapCoordinates(toCoordinates).Position;
var worldAngle = direction.ToAngle().Opposite();
foreach (var (ent, shootable) in ammo)
@ -383,6 +383,6 @@ public sealed partial class GunSystem : SharedGunSystem
var uidPlayer = EnsureComp<AnimationPlayerComponent>(gunUid);
_animPlayer.Stop(gunUid, uidPlayer, "muzzle-flash-light");
_animPlayer.Play((gunUid, uidPlayer), animTwo,"muzzle-flash-light");
_animPlayer.Play((gunUid, uidPlayer), animTwo, "muzzle-flash-light");
}
}

View file

@ -162,7 +162,7 @@ namespace Content.Server.Atmos.EntitySystems
if (component.LastPosition.HasValue)
{
// Check if position is out of range => don't update and disable
if (!component.LastPosition.Value.InRange(EntityManager, _transform, userPos, SharedInteractionSystem.InteractionRange))
if (!_transform.InRange(component.LastPosition.Value, userPos, SharedInteractionSystem.InteractionRange))
{
if (component.User is { } userId && component.Enabled)
_popup.PopupEntity(Loc.GetString("gas-analyzer-shutoff"), userId, userId);

View file

@ -146,7 +146,7 @@ public sealed partial class DragonSystem : EntitySystem
// cant stack rifts near eachother
foreach (var (_, riftXform) in EntityQuery<DragonRiftComponent, TransformComponent>(true))
{
if (riftXform.Coordinates.InRange(EntityManager, _transform, xform.Coordinates, RiftRange))
if (_transform.InRange(riftXform.Coordinates, xform.Coordinates, RiftRange))
{
_popup.PopupEntity(Loc.GetString("carp-rift-proximity", ("proximity", RiftRange)), uid, uid);
return;

View file

@ -325,7 +325,7 @@ namespace Content.Server.Guardian
if (!guardianComponent.GuardianLoose)
return;
if (!guardianXform.Coordinates.InRange(EntityManager, _transform, hostXform.Coordinates, guardianComponent.DistanceAllowed))
if (!_transform.InRange(guardianXform.Coordinates, hostXform.Coordinates, guardianComponent.DistanceAllowed))
RetractGuardian(hostUid, hostComponent, guardianUid, guardianComponent);
}

View file

@ -402,7 +402,8 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
var trans = transformQuery.GetComponent(uid);
var masterTrans = transformQuery.GetComponent(master);
if (!masterTrans.Coordinates.InRange(EntityManager, _transform, trans.Coordinates, 10f))
if (!_transform.InRange(masterTrans.Coordinates, trans.Coordinates, 10f)
)
{
Clean(uid, instrument);
}

View file

@ -65,7 +65,7 @@ public sealed class HealthAnalyzerSystem : EntitySystem
//Get distance between health analyzer and the scanned entity
var patientCoordinates = Transform(patient).Coordinates;
if (!patientCoordinates.InRange(EntityManager, _transformSystem, transform.Coordinates, component.MaxScanRange))
if (!_transformSystem.InRange(patientCoordinates, transform.Coordinates, component.MaxScanRange))
{
//Range too far, disable updates
StopAnalyzingEntity((uid, component), patient);

View file

@ -58,6 +58,7 @@ public sealed class PullController : VirtualController
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SharedGravitySystem _gravity = default!;
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
/// <summary>
/// If distance between puller and pulled entity lower that this threshold,
@ -133,8 +134,8 @@ public sealed class PullController : VirtualController
var range = 2f;
var fromUserCoords = coords.WithEntityId(player, EntityManager);
var userCoords = new EntityCoordinates(player, Vector2.Zero);
if (!coords.InRange(EntityManager, TransformSystem, userCoords, range))
if (!_transformSystem.InRange(coords, userCoords, range))
{
var direction = fromUserCoords.Position - userCoords.Position;

View file

@ -8,12 +8,19 @@ namespace Content.Server.NPC.HTN.Preconditions;
public sealed partial class CoordinatesInRangePrecondition : HTNPrecondition
{
[Dependency] private readonly IEntityManager _entManager = default!;
private SharedTransformSystem _transformSystem = default!;
[DataField("targetKey", required: true)] public string TargetKey = default!;
[DataField("rangeKey", required: true)]
public string RangeKey = default!;
public override void Initialize(IEntitySystemManager sysManager)
{
base.Initialize(sysManager);
_transformSystem = sysManager.GetEntitySystem<SharedTransformSystem>();
}
public override bool IsMet(NPCBlackboard blackboard)
{
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates, _entManager))
@ -22,6 +29,6 @@ public sealed partial class CoordinatesInRangePrecondition : HTNPrecondition
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var target, _entManager))
return false;
return coordinates.InRange(_entManager, _entManager.System<SharedTransformSystem>(), target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
return _transformSystem.InRange(coordinates, target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
}
}

View file

@ -8,12 +8,19 @@ namespace Content.Server.NPC.HTN.Preconditions;
public sealed partial class CoordinatesNotInRangePrecondition : HTNPrecondition
{
[Dependency] private readonly IEntityManager _entManager = default!;
private SharedTransformSystem _transformSystem = default!;
[DataField("targetKey", required: true)] public string TargetKey = default!;
[DataField("rangeKey", required: true)]
public string RangeKey = default!;
public override void Initialize(IEntitySystemManager sysManager)
{
base.Initialize(sysManager);
_transformSystem = sysManager.GetEntitySystem<SharedTransformSystem>();
}
public override bool IsMet(NPCBlackboard blackboard)
{
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates, _entManager))
@ -22,7 +29,7 @@ public sealed partial class CoordinatesNotInRangePrecondition : HTNPrecondition
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var target, _entManager))
return false;
return !coordinates.InRange(_entManager, _entManager.System<SharedTransformSystem>(), target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
return !_transformSystem.InRange(coordinates, target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
}
}

View file

@ -8,11 +8,17 @@ namespace Content.Server.NPC.HTN.Preconditions;
public sealed partial class TargetInRangePrecondition : HTNPrecondition
{
[Dependency] private readonly IEntityManager _entManager = default!;
private SharedTransformSystem _transformSystem = default!;
[DataField("targetKey", required: true)] public string TargetKey = default!;
[DataField("rangeKey", required: true)]
public string RangeKey = default!;
public override void Initialize(IEntitySystemManager sysManager)
{
base.Initialize(sysManager);
_transformSystem = sysManager.GetEntitySystem<SharedTransformSystem>();
}
public override bool IsMet(NPCBlackboard blackboard)
{
@ -23,6 +29,7 @@ public sealed partial class TargetInRangePrecondition : HTNPrecondition
!_entManager.TryGetComponent<TransformComponent>(target, out var targetXform))
return false;
return coordinates.InRange(_entManager, _entManager.System<SharedTransformSystem>(), targetXform.Coordinates, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
var transformSystem = _entManager.System<SharedTransformSystem>;
return _transformSystem.InRange(coordinates, targetXform.Coordinates, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
}
}

View file

@ -89,7 +89,8 @@ public sealed partial class MeleeOperator : HTNOperator, IHtnConditionalShutdown
HTNOperatorStatus status;
if (_entManager.TryGetComponent<NPCMeleeCombatComponent>(owner, out var combat) &&
blackboard.TryGetValue<EntityUid>(TargetKey, out var target, _entManager))
blackboard.TryGetValue<EntityUid>(TargetKey, out var target, _entManager) &&
target != EntityUid.Invalid)
{
combat.Target = target;

View file

@ -143,6 +143,9 @@ public sealed class NPCJukeSystem : EntitySystem
if (!_melee.TryGetWeapon(uid, out var weaponUid, out var weapon))
return;
if (!HasComp<TransformComponent>(melee.Target))
return;
var cdRemaining = weapon.NextAttack - _timing.CurTime;
var attackCooldown = TimeSpan.FromSeconds(1f / _melee.GetAttackRate(weaponUid, uid, weapon));

View file

@ -101,7 +101,7 @@ namespace Content.Server.Pointing.EntitySystems
{
if (HasComp<GhostComponent>(pointer))
{
return Transform(pointer).Coordinates.InRange(EntityManager, _transform, coordinates, 15);
return _transform.InRange(Transform(pointer).Coordinates, coordinates, 15);
}
else
{
@ -145,8 +145,7 @@ namespace Content.Server.Pointing.EntitySystems
_popup.PopupEntity(Loc.GetString("pointing-system-try-point-cannot-reach"), player, player);
return false;
}
var mapCoordsPointed = coordsPointed.ToMap(EntityManager, _transform);
var mapCoordsPointed = _transform.ToMapCoordinates(coordsPointed);
_rotateToFaceSystem.TryFaceCoordinates(player, mapCoordsPointed.Position);
var arrow = EntityManager.SpawnEntity("PointingArrow", coordsPointed);
@ -154,7 +153,7 @@ namespace Content.Server.Pointing.EntitySystems
if (TryComp<PointingArrowComponent>(arrow, out var pointing))
{
if (TryComp(player, out TransformComponent? xformPlayer))
pointing.StartPosition = EntityCoordinates.FromMap(arrow, xformPlayer.Coordinates.ToMap(EntityManager, _transform), _transform).Position;
pointing.StartPosition = _transform.ToCoordinates((player, xformPlayer), _transform.ToMapCoordinates(xformPlayer.Coordinates)).Position;
pointing.EndTime = _gameTiming.CurTime + PointDuration;

View file

@ -27,7 +27,8 @@ public sealed class IdExaminableSystem : EntitySystem
{
Act = () =>
{
var markup = FormattedMessage.FromMarkup(info);
var markup = FormattedMessage.FromMarkupOrThrow(info);
_examineSystem.SendExamineTooltip(args.User, uid, markup, false, false);
},
Text = Loc.GetString("id-examinable-component-verb-text"),

View file

@ -427,7 +427,7 @@ public abstract class SharedActionsSystem : EntitySystem
}
var entityCoordinatesTarget = GetCoordinates(netCoordinatesTarget);
_rotateToFaceSystem.TryFaceCoordinates(user, entityCoordinatesTarget.ToMapPos(EntityManager, _transformSystem));
_rotateToFaceSystem.TryFaceCoordinates(user, _transformSystem.ToMapCoordinates(entityCoordinatesTarget).Position);
if (!ValidateWorldTarget(user, entityCoordinatesTarget, (actionEnt, worldAction)))
return;
@ -533,7 +533,7 @@ public abstract class SharedActionsSystem : EntitySystem
if (action.Range <= 0)
return true;
return coords.InRange(EntityManager, _transformSystem, Transform(user).Coordinates, action.Range);
return _transformSystem.InRange(coords, Transform(user).Coordinates, action.Range);
}
return _interactionSystem.InRangeUnobstructed(user, coords, range: action.Range);

View file

@ -1,3 +1,4 @@
using Content.Shared.Humanoid;
using Content.Shared.Inventory;
using Robust.Shared.GameStates;
@ -30,4 +31,16 @@ public sealed partial class FoldableClothingComponent : Component
/// </summary>
[DataField]
public string? FoldedHeldPrefix;
/// <summary>
/// Which layers does this hide when Unfolded? See <see cref="HumanoidVisualLayers"/> and <see cref="HideLayerClothingComponent"/>
/// </summary>
[DataField]
public HashSet<HumanoidVisualLayers> UnfoldedHideLayers = new();
/// <summary>
/// Which layers does this hide when folded? See <see cref="HumanoidVisualLayers"/> and <see cref="HideLayerClothingComponent"/>
/// </summary>
[DataField]
public HashSet<HumanoidVisualLayers> FoldedHideLayers = new();
}

View file

@ -47,6 +47,10 @@ public sealed class FoldableClothingSystem : EntitySystem
if (ent.Comp.FoldedHeldPrefix != null)
_itemSystem.SetHeldPrefix(ent.Owner, ent.Comp.FoldedHeldPrefix, false, itemComp);
if (TryComp<HideLayerClothingComponent>(ent.Owner, out var hideLayerComp))
hideLayerComp.Slots = ent.Comp.FoldedHideLayers;
}
else
{
@ -59,6 +63,9 @@ public sealed class FoldableClothingSystem : EntitySystem
if (ent.Comp.FoldedHeldPrefix != null)
_itemSystem.SetHeldPrefix(ent.Owner, null, false, itemComp);
if (TryComp<HideLayerClothingComponent>(ent.Owner, out var hideLayerComp))
hideLayerComp.Slots = ent.Comp.UnfoldedHideLayers;
}
}
}

View file

@ -170,7 +170,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
if (args.BreakOnMove && !(!args.BreakOnWeightlessMove && _gravity.IsWeightless(args.User, xform: userXform)))
{
// Whether the user has moved too much from their original position.
if (!userXform.Coordinates.InRange(EntityManager, _transform, doAfter.UserPosition, args.MovementThreshold))
if (!_transform.InRange(userXform.Coordinates, doAfter.UserPosition, args.MovementThreshold))
return true;
// Whether the distance between the user and target(if any) has changed too much.

View file

@ -4,107 +4,109 @@ using Content.Shared.Whitelist;
using JetBrains.Annotations;
using Robust.Shared.Containers;
namespace Content.Shared.Storage.EntitySystems
namespace Content.Shared.Storage.EntitySystems;
/// <summary>
/// <c>ItemMapperSystem</c> is a system that on each initialization, insertion, removal of an entity from
/// given <see cref="ItemMapperComponent"/> (with appropriate storage attached) will check each stored item to see
/// if its tags/component, and overall quantity match <see cref="ItemMapperComponent.MapLayers"/>.
/// </summary>
[UsedImplicitly]
public abstract class SharedItemMapperSystem : EntitySystem
{
/// <summary>
/// <c>ItemMapperSystem</c> is a system that on each initialization, insertion, removal of an entity from
/// given <see cref="ItemMapperComponent"/> (with appropriate storage attached) will check each stored item to see
/// if its tags/component, and overall quantity match <see cref="ItemMapperComponent.MapLayers"/>.
/// </summary>
[UsedImplicitly]
public abstract class SharedItemMapperSystem : EntitySystem
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
/// <inheritdoc />
public override void Initialize()
{
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
base.Initialize();
SubscribeLocalEvent<ItemMapperComponent, ComponentInit>(InitLayers);
SubscribeLocalEvent<ItemMapperComponent, EntInsertedIntoContainerMessage>(MapperEntityInserted);
SubscribeLocalEvent<ItemMapperComponent, EntRemovedFromContainerMessage>(MapperEntityRemoved);
}
/// <inheritdoc />
public override void Initialize()
private void InitLayers(EntityUid uid, ItemMapperComponent component, ComponentInit args)
{
foreach (var (layerName, val) in component.MapLayers)
{
base.Initialize();
SubscribeLocalEvent<ItemMapperComponent, ComponentInit>(InitLayers);
SubscribeLocalEvent<ItemMapperComponent, EntInsertedIntoContainerMessage>(MapperEntityInserted);
SubscribeLocalEvent<ItemMapperComponent, EntRemovedFromContainerMessage>(MapperEntityRemoved);
val.Layer = layerName;
}
private void InitLayers(EntityUid uid, ItemMapperComponent component, ComponentInit args)
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent))
{
foreach (var (layerName, val) in component.MapLayers)
{
val.Layer = layerName;
}
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent))
{
var list = new List<string>(component.MapLayers.Keys);
_appearance.SetData(uid, StorageMapVisuals.InitLayers, new ShowLayerData(list), appearanceComponent);
}
// Ensure appearance is correct with current contained entities.
UpdateAppearance(uid, component);
var list = new List<string>(component.MapLayers.Keys);
_appearance.SetData(uid, StorageMapVisuals.InitLayers, new ShowLayerData(list), appearanceComponent);
}
private void MapperEntityRemoved(EntityUid uid, ItemMapperComponent itemMapper,
EntRemovedFromContainerMessage args)
// Ensure appearance is correct with current contained entities.
UpdateAppearance(uid, component);
}
private void MapperEntityRemoved(EntityUid uid, ItemMapperComponent itemMapper, EntRemovedFromContainerMessage args)
{
if (itemMapper.ContainerWhitelist != null && !itemMapper.ContainerWhitelist.Contains(args.Container.ID))
return;
UpdateAppearance(uid, itemMapper);
}
private void MapperEntityInserted(EntityUid uid,
ItemMapperComponent itemMapper,
EntInsertedIntoContainerMessage args)
{
if (itemMapper.ContainerWhitelist != null && !itemMapper.ContainerWhitelist.Contains(args.Container.ID))
return;
UpdateAppearance(uid, itemMapper);
}
private void UpdateAppearance(EntityUid uid, ItemMapperComponent? itemMapper = null)
{
if (!Resolve(uid, ref itemMapper))
return;
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent)
&& TryGetLayers(uid, itemMapper, out var containedLayers))
{
if (itemMapper.ContainerWhitelist != null && !itemMapper.ContainerWhitelist.Contains(args.Container.ID))
return;
UpdateAppearance(uid, itemMapper);
}
private void MapperEntityInserted(EntityUid uid, ItemMapperComponent itemMapper,
EntInsertedIntoContainerMessage args)
{
if (itemMapper.ContainerWhitelist != null && !itemMapper.ContainerWhitelist.Contains(args.Container.ID))
return;
UpdateAppearance(uid, itemMapper);
}
private void UpdateAppearance(EntityUid uid, ItemMapperComponent? itemMapper = null)
{
if(!Resolve(uid, ref itemMapper))
return;
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent)
&& TryGetLayers(uid, itemMapper, out var containedLayers))
{
_appearance.SetData(uid, StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers), appearanceComponent);
}
}
/// <summary>
/// Method that iterates over storage of the entity in <paramref name="uid"/> and sets <paramref name="containedLayers"/> according to
/// <paramref name="itemMapper"/> definition. It will have O(n*m) time behavior (n - number of entities in container, and m - number of
/// definitions in <paramref name="containedLayers"/>.
/// </summary>
/// <param name="uid">EntityUid used to search the storage</param>
/// <param name="itemMapper">component that contains definition used to map <see cref="Content.Shared.Whitelist.EntityWhitelist">whitelist</see> in
/// <c>mapLayers</c> to string.
/// </param>
/// <param name="containedLayers">list of <paramref name="itemMapper"/> layers that should be visible</param>
/// <returns>false if <c>msg.Container.Owner</c> is not a storage, true otherwise.</returns>
private bool TryGetLayers(EntityUid uid,
ItemMapperComponent itemMapper,
out List<string> showLayers)
{
var containedLayers = _container.GetAllContainers(uid)
.Where(c => itemMapper.ContainerWhitelist?.Contains(c.ID) ?? true).SelectMany(cont => cont.ContainedEntities).ToArray();
var list = new List<string>();
foreach (var mapLayerData in itemMapper.MapLayers.Values)
{
var count = containedLayers.Count(ent => _whitelistSystem.IsWhitelistPassOrNull(mapLayerData.Whitelist,
ent));
if (count >= mapLayerData.MinCount && count <= mapLayerData.MaxCount)
{
list.Add(mapLayerData.Layer);
}
}
showLayers = list;
return true;
_appearance.SetData(uid,
StorageMapVisuals.LayerChanged,
new ShowLayerData(containedLayers),
appearanceComponent);
}
}
/// <summary>
/// Method that iterates over storage of the entity in <paramref name="uid"/> and sets <paramref name="showLayers"/>
/// according to <paramref name="itemMapper"/> definition. It will have O(n*m) time behavior
/// (n - number of entities in container, and m - number of definitions in <paramref name="showLayers"/>).
/// </summary>
/// <param name="uid">EntityUid used to search the storage</param>
/// <param name="itemMapper">component that contains definition used to map
/// <see cref="EntityWhitelist">Whitelist</see> in <see cref="ItemMapperComponent.MapLayers"/> to string.
/// </param>
/// <param name="showLayers">list of <paramref name="itemMapper"/> layers that should be visible</param>
/// <returns>false if <c>msg.Container.Owner</c> is not a storage, true otherwise.</returns>
private bool TryGetLayers(EntityUid uid, ItemMapperComponent itemMapper, out List<string> showLayers)
{
var containedLayers = _container.GetAllContainers(uid)
.Where(c => itemMapper.ContainerWhitelist?.Contains(c.ID) ?? true)
.SelectMany(cont => cont.ContainedEntities)
.ToArray();
var list = new List<string>();
foreach (var mapLayerData in itemMapper.MapLayers.Values)
{
var count = containedLayers.Count(ent => _whitelistSystem.IsWhitelistPassOrNull(mapLayerData.Whitelist,
ent));
if (count >= mapLayerData.MinCount && count <= mapLayerData.MaxCount)
{
list.Add(mapLayerData.Layer);
}
}
showLayers = list;
return true;
}
}

View file

@ -1,11 +1,4 @@
Entries:
- author: deltanedas
changes:
- message: Flaming mice no longer completely engulf people they touch.
type: Tweak
id: 6416
time: '2024-04-22T08:42:26.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/27202
- author: Weax
changes:
- message: The CLF3 reaction now requires heating first before you can engulf chemistry
@ -3813,3 +3806,10 @@
id: 6915
time: '2024-07-13T12:15:57.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/25750
- author: coffeeware
changes:
- message: Lizards will no longer lose their snouts when equipping head bandanas
type: Fix
id: 6916
time: '2024-07-14T02:59:45.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/29979

File diff suppressed because one or more lines are too long

View file

@ -20,6 +20,8 @@
- state: icon_mask
map: [ "unfoldedLayer" ]
visible: false
- type: HideLayerClothing # needed since head bandana inherits from mask bandana
slots: []
- type: Tag
tags:
- Bandana

View file

@ -391,7 +391,6 @@
- type: HideLayerClothing
slots:
- Hair
- Snout
- HeadTop
- HeadSide

View file

@ -11,6 +11,9 @@
- HEAD
unfoldedSlots:
- MASK
foldedHideLayers: []
unfoldedHideLayers:
- Snout
- type: Mask
- type: IngestionBlocker
- type: IdentityBlocker

View file

@ -62,7 +62,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{806ED41A-411B-4B3B-BEB6-DEC6DCA4C205}"
ProjectSection(SolutionItems) = preProject
Tools\generate_hashes.ps1 = Tools\generate_hashes.ps1
Tools\gen_build_info.py = Tools\gen_build_info.py
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.Shared.Scripting", "RobustToolbox\Robust.Shared.Scripting\Robust.Shared.Scripting.csproj", "{41B450C0-A361-4CD7-8121-7072B8995CFC}"

View file

@ -29,7 +29,7 @@ CHANGELOG_RSS_KEY = os.environ.get("CHANGELOG_RSS_KEY")
# Change these to suit your server settings
# https://docs.fabfile.org/en/stable/getting-started.html#run-commands-via-connections-and-run
SSH_HOST = "centcomm.spacestation14.io"
SSH_HOST = "moon.spacestation14.com"
SSH_USER = "changelog-rss"
SSH_PORT = 22
RSS_FILE = "changelog.xml"

View file

@ -1,96 +0,0 @@
#!/usr/bin/env python3
# Generates build info and injects it into the server zip files.
import codecs
import hashlib
import io
import json
import os
import subprocess
from zipfile import ZipFile, ZIP_DEFLATED
FILE = "SS14.Client.zip"
SERVER_FILES = [
"SS14.Server_linux-x64.zip",
"SS14.Server_linux-arm64.zip",
"SS14.Server_win-x64.zip",
"SS14.Server_osx-x64.zip"
]
VERSION = os.environ['GITHUB_SHA']
FORK_ID = "sunrise"
BUILD_URL = f"https://shizainc.com/sunrise_builds/sunrise/builds/{{FORK_VERSION}}/{FILE}"
MANIFEST_URL = f"https://shizainc.com/sunrise_cdn/version/{{FORK_VERSION}}/manifest"
MANIFEST_DOWNLOAD_URL = f"https://shizainc.com/sunrise_cdn/version/{{FORK_VERSION}}/download"
def main() -> None:
client_file = os.path.join("release", FILE)
manifest = generate_build_json(client_file)
for server in SERVER_FILES:
inject_manifest(os.path.join("release", server), manifest)
def inject_manifest(zip_path: str, manifest: str) -> None:
with ZipFile(zip_path, "a", compression=ZIP_DEFLATED) as z:
z.writestr("build.json", manifest)
def generate_build_json(file: str) -> str:
# Env variables set by Jenkins.
hash = sha256_file(file)
engine_version = get_engine_version()
manifest_hash = generate_manifest_hash(file)
return json.dumps({
"download": BUILD_URL,
"hash": hash,
"version": VERSION,
"fork_id": FORK_ID,
"engine_version": engine_version,
"manifest_url": MANIFEST_URL,
"manifest_download_url": MANIFEST_DOWNLOAD_URL,
"manifest_hash": manifest_hash
})
def generate_manifest_hash(file: str) -> str:
zip = ZipFile(file)
infos = zip.infolist()
infos.sort(key=lambda i: i.filename)
bytesIO = io.BytesIO()
writer = codecs.getwriter("UTF-8")(bytesIO)
writer.write("Robust Content Manifest 1\n")
for info in infos:
if info.filename[-1] == "/":
continue
bytes = zip.read(info)
hash = hashlib.blake2b(bytes, digest_size=32).hexdigest().upper()
writer.write(f"{hash} {info.filename}\n")
manifestHash = hashlib.blake2b(bytesIO.getbuffer(), digest_size=32)
return manifestHash.hexdigest().upper()
def get_engine_version() -> str:
proc = subprocess.run(["git", "describe","--tags", "--abbrev=0"], stdout=subprocess.PIPE, cwd="RobustToolbox", check=True, encoding="UTF-8")
tag = proc.stdout.strip()
assert tag.startswith("v")
return tag[1:] # Cut off v prefix.
def sha256_file(path: str) -> str:
with open(path, "rb") as f:
h = hashlib.sha256()
for b in iter(lambda: f.read(4096), b""):
h.update(b)
return h.hexdigest()
if __name__ == '__main__':
main()

View file

@ -0,0 +1,56 @@
#!/usr/bin/env python3
import requests
import os
import subprocess
GITHUB_TOKEN = os.environ["GITHUB_TOKEN"]
PUBLISH_TOKEN = os.environ["PUBLISH_TOKEN"]
ARTIFACT_ID = os.environ["ARTIFACT_ID"]
GITHUB_REPOSITORY = os.environ["GITHUB_REPOSITORY"]
VERSION = os.environ['GITHUB_SHA']
#
# CONFIGURATION PARAMETERS
# Forks should change these to publish to their own infrastructure.
#
ROBUST_CDN_URL = "https://wizards.cdn.spacestation14.com/"
FORK_ID = "wizards"
def main():
print("Fetching artifact URL from API...")
artifact_url = get_artifact_url()
print(f"Artifact URL is {artifact_url}, publishing to Robust.Cdn")
data = {
"version": VERSION,
"engineVersion": get_engine_version(),
"archive": artifact_url
}
headers = {
"Authorization": f"Bearer {PUBLISH_TOKEN}",
"Content-Type": "application/json"
}
resp = requests.post(f"{ROBUST_CDN_URL}fork/{FORK_ID}/publish", json=data, headers=headers)
resp.raise_for_status()
print("Publish succeeded!")
def get_artifact_url() -> str:
headers = {
"Authorization": f"Bearer {GITHUB_TOKEN}",
"X-GitHub-Api-Version": "2022-11-28"
}
resp = requests.get(f"https://api.github.com/repos/{GITHUB_REPOSITORY}/actions/artifacts/{ARTIFACT_ID}/zip", allow_redirects=False, headers=headers)
resp.raise_for_status()
return resp.headers["Location"]
def get_engine_version() -> str:
proc = subprocess.run(["git", "describe","--tags", "--abbrev=0"], stdout=subprocess.PIPE, cwd="RobustToolbox", check=True, encoding="UTF-8")
tag = proc.stdout.strip()
assert tag.startswith("v")
return tag[1:] # Cut off v prefix.
if __name__ == '__main__':
main()