Skip to content

Commit

Permalink
PTK Rework (#2521)
Browse files Browse the repository at this point in the history
* PTK changes: proof of concept

* Add hard rock ores for other asteroids than ice

* IconSmoothSystem: reduce redundnacy

* add NF prefix to OreDiamondDense refs

* Fix salvage.yml merge issues

* No duped crate spawner

* PTK-1500e, not 3000e

* Fix asteroid scrap spawner parenting

* PTK description

* Add "overpowered" comment on PTK

* Create supercompacted.yml

* Added super compacted spawners

* Update supercompacted.yml

* mineral spawners

* undupe spawners

* Separate mineral tables out from floorplan

* Fix scrap mineral table

* WIP: add RoomMarkers

* minerals to spawners, fix rock dupe

* Fix missing ice spawner ref

* Sprites for mineral spawns, hard supercomp. spawns

* rich hard mineral spawners

* fewer diamonds on andesite, more chunk spawners

* More frequent clusters

* order of magnitude

---------

Co-authored-by: Dvir <[email protected]>
Co-authored-by: Dvir <[email protected]>
  • Loading branch information
3 people authored Dec 24, 2024
1 parent 3941232 commit 506679f
Show file tree
Hide file tree
Showing 28 changed files with 9,055 additions and 780 deletions.
30 changes: 17 additions & 13 deletions Content.Client/IconSmoothing/IconSmoothSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,25 @@ public void SetStateBase(EntityUid uid, IconSmoothComponent component, string ne

private void SetCornerLayers(SpriteComponent sprite, IconSmoothComponent component)
{
sprite.LayerMapRemove(CornerLayers.SE);
sprite.LayerMapRemove(CornerLayers.NE);
sprite.LayerMapRemove(CornerLayers.NW);
sprite.LayerMapRemove(CornerLayers.SW);

// Frontier: Allow overlays on entities using CornerLayers smoothing - don't remove layers, adjust existing ones or create new ones.
var state0 = $"{component.StateBase}0";
sprite.LayerMapSet(CornerLayers.SE, sprite.AddLayerState(state0));
sprite.LayerSetDirOffset(CornerLayers.SE, DirectionOffset.None);
sprite.LayerMapSet(CornerLayers.NE, sprite.AddLayerState(state0));
sprite.LayerSetDirOffset(CornerLayers.NE, DirectionOffset.CounterClockwise);
sprite.LayerMapSet(CornerLayers.NW, sprite.AddLayerState(state0));
sprite.LayerSetDirOffset(CornerLayers.NW, DirectionOffset.Flip);
sprite.LayerMapSet(CornerLayers.SW, sprite.AddLayerState(state0));
sprite.LayerSetDirOffset(CornerLayers.SW, DirectionOffset.Clockwise);
SetCornerLayerState(sprite, CornerLayers.SE, DirectionOffset.None, state0);
SetCornerLayerState(sprite, CornerLayers.NE, DirectionOffset.CounterClockwise, state0);
SetCornerLayerState(sprite, CornerLayers.NW, DirectionOffset.Flip, state0);
SetCornerLayerState(sprite, CornerLayers.SW, DirectionOffset.Clockwise, state0);
// End Frontier: Allow overlays on entities using CornerLayers smoothing - don't remove layers, adjust existing ones or create new ones.
}

// Frontier: set layer function to remove redundancy
private void SetCornerLayerState(SpriteComponent sprite, CornerLayers corner, DirectionOffset offset, string state)
{
if (sprite.LayerMapTryGet(corner, out var layer))
sprite.LayerSetState(layer, state);
else
sprite.LayerMapSet(corner, sprite.AddLayerState(state));
sprite.LayerSetDirOffset(corner, offset);
}
// End Frontier: set layer function to remove redundancy

private void OnShutdown(EntityUid uid, IconSmoothComponent component, ComponentShutdown args)
{
Expand Down
16 changes: 16 additions & 0 deletions Content.Server/Gatherable/GatherableSystem.Projectile.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Gatherable.Components;
using Content.Shared.Mining.Components;
using Content.Shared.Projectiles;
using Robust.Shared.Physics.Events;

Expand All @@ -21,6 +22,21 @@ private void OnProjectileCollide(Entity<GatheringProjectileComponent> gathering,
return;
}

// Frontier: gathering changes
// bad gatherer - not strong enough
if (_whitelistSystem.IsWhitelistFail(gatherable.ToolWhitelist, gathering.Owner))
{
QueueDel(gathering);
return;
}
// Too strong (e.g. overpen) - gathers ore but destroys it
if (TryComp<OreVeinComponent>(args.OtherEntity, out var oreVein)
&& _whitelistSystem.IsWhitelistPass(oreVein.GatherDestructionWhitelist, gathering.Owner))
{
oreVein.PreventSpawning = true;
}
// End Frontier: gathering changes

Gather(args.OtherEntity, gathering, gatherable);
gathering.Comp.Amount--;

Expand Down
5 changes: 5 additions & 0 deletions Content.Server/Mining/MiningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ private void OnDestruction(EntityUid uid, OreVeinComponent component, Destructio
if (component.CurrentOre == null)
return;

// Frontier
if (component.PreventSpawning)
return;
// End Frontier

var proto = _proto.Index<OrePrototype>(component.CurrentOre);

if (proto.OreEntity == null)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Server._NF.Gatherable.Components;

/// <summary>
/// Component denotes an item can be used to gather from hard rocks.
/// </summary>
[RegisterComponent]
public sealed partial class MiningGatheringHardComponent : Component;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Server._NF.Gatherable.Components;

/// <summary>
/// Component denotes an item can be used to gather from softer rocks.
/// </summary>
[RegisterComponent]
public sealed partial class MiningGatheringSoftComponent : Component;
13 changes: 13 additions & 0 deletions Content.Shared/Mining/Components/OreVeinComponent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Shared.Random;
using Robust.Shared.Prototypes;
using Content.Shared.Whitelist; // Frontier

namespace Content.Shared.Mining.Components;

Expand Down Expand Up @@ -28,4 +29,16 @@ public sealed partial class OreVeinComponent : Component
/// </summary>
[DataField]
public ProtoId<OrePrototype>? CurrentOre;

/// <summary>
/// Frontier: if this ore is somehow "ruined", set this to true before destroying the entity.
/// </summary>
[DataField]
public bool PreventSpawning;

/// <summary>
/// Frontier: whitelist to check when gathering materials - these entities are too strong and ruin the ore.
/// </summary>
[DataField]
public EntityWhitelist? GatherDestructionWhitelist;
}
3 changes: 1 addition & 2 deletions Content.Shared/Weapons/Reflect/ReflectComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed partial class ReflectComponent : Component
/// What we reflect.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("reflects")]
public ReflectType Reflects = ReflectType.Energy | ReflectType.NonEnergy | ReflectType.ShuttleKinetic; // Frontier: added ShuttleKinetic
public ReflectType Reflects = ReflectType.Energy | ReflectType.NonEnergy;

/// <summary>
/// Probability for a projectile to be reflected.
Expand All @@ -35,5 +35,4 @@ public enum ReflectType : byte
None = 0,
NonEnergy = 1 << 0,
Energy = 1 << 1,
ShuttleKinetic = 1 << 7, //Frontier: PTK-800
}
Loading

0 comments on commit 506679f

Please sign in to comment.