Refactors, bugfixs + Crystals (#127)

* fix dwarf displacement map

* Big Fireplace update

* add crystalls placeholder

* bonfire update

* displaccement update

* Update wallmount_torch.yml
This commit is contained in:
Ed
2024-05-03 20:40:31 +03:00
committed by GitHub
parent e5246f1e76
commit dd84d48fed
38 changed files with 365 additions and 94 deletions

View File

@@ -77,5 +77,11 @@ namespace Content.Server.Atmos.Components
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float FirestackFade = -0.1f;
/// <summary>
/// CrystallPunk fireplace fuel
/// </summary>
[DataField]
public float CP14FireplaceFuel = 10f;
}
}

View File

@@ -39,7 +39,7 @@ public sealed class RandomSpriteSystem: SharedRandomSpriteSystem
component.Selected.EnsureCapacity(groups.Count);
Color? previousColor = null;
Color? previousColor = component.CP14InheritBaseColor; //CrystallPunk
foreach (var group in groups)
{

View File

@@ -1,3 +1,5 @@
using Robust.Shared.Audio;
namespace Content.Server._CP14.Temperature.Fireplace;
/// <summary>
@@ -7,6 +9,9 @@ namespace Content.Server._CP14.Temperature.Fireplace;
[RegisterComponent, Access(typeof(CP14FireplaceSystem))]
public sealed partial class CP14FireplaceComponent : Component
{
[DataField]
public string ContainerId = "storagebase";
/// <summary>
/// The abstract amount of fuel that is used to keep a fire burning
/// </summary>
@@ -23,7 +28,7 @@ public sealed partial class CP14FireplaceComponent : Component
/// current fuel quantity
/// </summary>
[DataField]
public float CurrentFuel;
public float CurrentFuel = 10f;
/// <summary>
/// how much fuel is wasted every "UpdateFrequency"
@@ -34,18 +39,9 @@ public sealed partial class CP14FireplaceComponent : Component
[DataField]
public TimeSpan UpdateFrequency = TimeSpan.FromSeconds(2f);
/// <summary>
/// whether fuel can be added by hand
/// </summary>
[DataField]
public bool CanInsertByHand = true;
/// <summary>
/// whether the fuel can be supplied by contact
/// </summary>
[DataField]
public bool CanInsertByCollide = false;
[DataField]
public TimeSpan NextUpdateTime = TimeSpan.Zero;
[DataField]
public SoundSpecifier InsertFuelSound = new SoundPathSpecifier("/Audio/_CP14/Items/campfire_whoosh.ogg");
}

View File

@@ -1,20 +0,0 @@
using Robust.Shared.Audio;
namespace Content.Server._CP14.Temperature.Fireplace;
/// <summary>
/// Allows this object to be used as fuel for a fireplace
/// </summary>
[RegisterComponent, Access(typeof(CP14FireplaceSystem))]
public sealed partial class CP14FireplaceFuelComponent : Component
{
/// <summary>
/// How much fuel will be added in fireplace
/// </summary>
[DataField]
public float Fuel = 10f;
[DataField]
public SoundSpecifier InsertFuelSound = new SoundPathSpecifier("/Audio/_CP14/Items/campfire_whoosh.ogg");
}

View File

@@ -5,6 +5,7 @@ using Content.Shared._CP14.Temperature;
using Content.Shared.Interaction;
using Content.Shared.Throwing;
using Robust.Server.Audio;
using Robust.Server.Containers;
using Robust.Server.GameObjects;
using Robust.Shared.Physics.Events;
using Robust.Shared.Timing;
@@ -15,6 +16,7 @@ public sealed partial class CP14FireplaceSystem : EntitySystem
{
[Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly ContainerSystem _containerSystem = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly FlammableSystem _flammable = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
@@ -24,9 +26,6 @@ public sealed partial class CP14FireplaceSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<CP14FireplaceComponent, OnFireChangedEvent>(OnFireChanged);
SubscribeLocalEvent<CP14FireplaceComponent, InteractUsingEvent>(OnInteractUsing);
SubscribeLocalEvent<CP14FireplaceComponent, StartCollideEvent>(OnCollide);
}
private void OnFireChanged(Entity<CP14FireplaceComponent> fireplace, ref OnFireChangedEvent args)
@@ -38,47 +37,37 @@ public sealed partial class CP14FireplaceSystem : EntitySystem
flammable.FirestackFade = 0;
}
private void OnInteractUsing(Entity<CP14FireplaceComponent> fireplace, ref InteractUsingEvent args)
private bool TryFoundFuelInStorage(Entity<CP14FireplaceComponent> fireplace, out Entity<FlammableComponent>? fuel)
{
if (!fireplace.Comp.CanInsertByHand)
return;
fuel = null;
var container = _containerSystem.GetContainer(fireplace, fireplace.Comp.ContainerId);
if (!TryComp<CP14FireplaceFuelComponent>(args.Used, out var fuel))
return;
TryInsertFuel(fireplace, args.Used, fuel);
}
private void OnCollide(Entity<CP14FireplaceComponent> fireplace, ref StartCollideEvent args)
{
if (!fireplace.Comp.CanInsertByCollide)
return;
if (!TryComp<CP14FireplaceFuelComponent>(args.OtherEntity, out var fuel))
return;
TryInsertFuel(fireplace, args.OtherEntity, fuel);
}
private bool TryInsertFuel(Entity<CP14FireplaceComponent> fireplace, EntityUid fuelUid, CP14FireplaceFuelComponent fuel)
{
if (fireplace.Comp.CurrentFuel > fireplace.Comp.MaxFuelLimit)
{
_popupSystem.PopupEntity(Loc.GetString("cp14-fireplace-full", ("target", fireplace)), fireplace);
if (container.ContainedEntities.Count == 0)
return false;
foreach (var ent in container.ContainedEntities)
{
if (!TryComp<FlammableComponent>(ent, out var flammable))
continue;
fuel = new Entity<FlammableComponent>(ent, flammable);
return true;
}
if (!TryComp<FlammableComponent>(fireplace, out var flammable))
return false;
return false;
}
fireplace.Comp.CurrentFuel += fuel.Fuel;
private void ConsumeFuel(EntityUid uid, CP14FireplaceComponent component, Entity<FlammableComponent> fuel)
{
if (!TryComp<FlammableComponent>(uid, out var flammable))
return;
component.CurrentFuel += fuel.Comp.CP14FireplaceFuel;
if (flammable.OnFire)
_audio.PlayPvs(fuel.InsertFuelSound, fireplace);
_audio.PlayPvs(component.InsertFuelSound, uid);
UpdateAppearance(fireplace, fireplace.Comp);
QueueDel(fuelUid);
return true;
QueueDel(fuel);
}
public override void Update(float frameTime)
@@ -104,6 +93,9 @@ public sealed partial class CP14FireplaceSystem : EntitySystem
}
else
{
if (TryFoundFuelInStorage(new Entity<CP14FireplaceComponent>(uid, fireplace), out var fuel) && fuel != null)
ConsumeFuel(uid, fireplace, fuel.Value);
flammable.FirestackFade = -fireplace.FireFadeDelta;
}
}

View File

@@ -24,4 +24,10 @@ public sealed partial class RandomSpriteComponent : Component
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("selected")]
public Dictionary<string, (string State, Color? Color)> Selected = new();
/// <summary>
/// CP14 Base Random Sprite color
/// </summary>
[DataField]
public Color CP14InheritBaseColor = Color.White;
}

View File

@@ -1 +0,0 @@
cp14-fireplace-full = There's no more room in {$target}!

View File

@@ -1 +0,0 @@
cp14-fireplace-full = В {$target} больше ничего не влезет!

View File

@@ -9,9 +9,9 @@
sprite: _CP14/Structures/Furniture/bonfire.rsi
layers:
- state: base
- state: full1
- state: full-1
visible: false
map: ["fuel"]
- map: ["enum.StorageFillLayers.Fill"]
- type: Construction
graph: CP14Bonfire
node: CP14Bonfire
@@ -26,20 +26,12 @@
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: GenericVisualizer
visuals:
enum.FireplaceFuelVisuals.Status:
fuel:
Empty: { visible: false }
Medium: { visible: true, state: full1 }
Full: { visible: true, state: full2 }
- type: StorageFillVisualizer
maxFillLevels: 2
fillBaseName: full
- type: FireVisuals
sprite: _CP14/Structures/Furniture/bonfire.rsi
normalState: burning
- type: entity
id: CP14Stick
parent: CP14Bucket
name: Stick!!!
components:
- type: CP14FireplaceFuel
- type: Storage
grid:
- 0,0,2,1

View File

@@ -56,7 +56,6 @@
- type: CP14Fireplace
maxFuelLimit: 150
currentFuel: 150
canInsertByHand: false
- type: FireVisuals
sprite: _CP14/Structures/Furniture/wallmount_torch.rsi
normalState: fire

View File

@@ -43,6 +43,21 @@
- type: CP14FlammableEntityHeater
- type: CP14FlammableSolutionHeater
- type: CP14Fireplace
- type: ContainerContainer
containers:
storagebase: !type:Container
ents: []
- type: Storage
maxItemSize: Normal
grid:
- 0,0,2,2
blacklist:
components:
- IgnitionSource
- type: UserInterface
interfaces:
enum.StorageUiKey.Key:
type: StorageBoundUserInterface
- type: entity
id: CP14AlchemyFurnaceDebug
@@ -110,4 +125,7 @@
mask:
- TableMask
layer:
- TableLayer
- TableLayer
- type: Storage
grid:
- 0,0,2,2

View File

@@ -0,0 +1,116 @@
- type: entity
id: CP14WallmountCrystalBase
parent:
- BaseStructure
abstract: true
placement:
mode: SnapgridCenter
components:
- type: Sprite
drawdepth: Mobs
sprite: _CP14/Structures/Wallmount/wallmount_crystal.rsi
layers:
- state: crystal1
map: ["random"]
shader: unshaded
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Glass
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 20
behaviors:
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "0.49,0.49,-0.49,0.36"
density: 60
mask:
- MachineMask
layer:
- MidImpassable
- LowImpassable
- type: RandomSprite
available:
- random:
crystal1: Inherit
crystal2: Inherit
crystal3: Inherit
- type: PointLight
radius: 1.5
energy: 1
- type: entity
id: CP14WallmountCrystalRubies
parent: CP14WallmountCrystalBase
name: sparkling rubies
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#ff3d0b"
- type: PointLight
color: "#ff3d0b"
- type: entity
id: CP14WallmountCrystalTopazes
parent: CP14WallmountCrystalBase
name: sparkling topazes
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#ffe269"
- type: PointLight
color: "#ffe269"
- type: entity
id: CP14WallmountCrystalEmeralds
parent: CP14WallmountCrystalBase
name: sparkling emeralds
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#30be81"
- type: PointLight
color: "#30be81"
- type: entity
id: CP14WallmountCrystalSapphires
parent: CP14WallmountCrystalBase
name: sparkling sapphires
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#5eabeb"
- type: PointLight
color: "#5eabeb"
- type: entity
id: CP14WallmountCrystalAmethysts
parent: CP14WallmountCrystalBase
name: sparkling amethysts
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#a878d1"
- type: PointLight
color: "#a878d1"
- type: entity
id: CP14WallmountCrystalDiamonds
parent: CP14WallmountCrystalBase
name: sparkling diamonds
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#f8f8f8"
- type: PointLight
color: "#f8f8f8"

View File

@@ -10,7 +10,7 @@
components:
- type: Sprite
drawdepth: Mobs
sprite: _CP14/Structures/Decoration/wallmount_decor.rsi
sprite: _CP14/Structures/Wallmount/wallmount_decor.rsi
layers:
- state: boards
map: ["random"]
@@ -49,7 +49,7 @@
components:
- type: Sprite
drawdepth: Mobs
sprite: _CP14/Structures/Decoration/wallmount_decor.rsi
sprite: _CP14/Structures/Wallmount/wallmount_decor.rsi
layers:
- state: web
map: ["random"]
@@ -88,7 +88,7 @@
components:
- type: Sprite
drawdepth: Mobs
sprite: _CP14/Structures/Decoration/wallmount_decor.rsi
sprite: _CP14/Structures/Wallmount/wallmount_decor.rsi
layers:
- state: vines
- type: Damageable

View File

@@ -0,0 +1,119 @@
- type: entity
id: CP14CrystalBase
abstract: true
parent: BaseStructure
components:
- type: Sprite
drawdepth: Mobs
sprite: _CP14/Structures/crystal.rsi
offset: 0, 0.25
layers:
- state: big
map: ["random"]
shader: unshaded
noRot: true
- type: Physics
bodyType: Static
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Glass
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 20
behaviors:
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeCircle
radius: 0.45
density: 60
mask:
- MachineMask
layer:
- MidImpassable
- LowImpassable
- BulletImpassable
- Opaque
- type: RandomSprite
available:
- random:
big: Inherit
medium: Inherit
small: Inherit
- type: PointLight
radius: 2
energy: 2
- type: entity
id: CP14CrystalRubies
parent: CP14CrystalBase
name: sparkling rubies
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#ff3d0b"
- type: PointLight
color: "#ff3d0b"
- type: entity
id: CP14CrystalTopazes
parent: CP14CrystalBase
name: sparkling topazes
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#ffe269"
- type: PointLight
color: "#ffe269"
- type: entity
id: CP14CrystalEmeralds
parent: CP14CrystalBase
name: sparkling emeralds
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#30be81"
- type: PointLight
color: "#30be81"
- type: entity
id: CP14CrystalSapphires
parent: CP14CrystalBase
name: sparkling sapphires
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#5eabeb"
- type: PointLight
color: "#5eabeb"
- type: entity
id: CP14CrystalAmethysts
parent: CP14CrystalBase
name: sparkling amethysts
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#a878d1"
- type: PointLight
color: "#a878d1"
- type: entity
id: CP14CrystalDiamonds
parent: CP14CrystalBase
name: sparkling diamonds
description: wawa
components:
- type: RandomSprite
cP14InheritBaseColor: "#f8f8f8"
- type: PointLight
color: "#f8f8f8"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

View File

@@ -11,10 +11,13 @@
"name": "base"
},
{
"name": "full1"
"name": "full-0"
},
{
"name": "full2"
"name": "full-1"
},
{
"name": "full-2"
},
{
"name": "burning",

Binary file not shown.

After

Width:  |  Height:  |  Size: 1007 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

View File

@@ -0,0 +1,23 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "By TheShuEd",
"size": {
"x": 32,
"y": 96
},
"states": [
{
"name": "crystal1",
"directions": 4
},
{
"name": "crystal2",
"directions": 4
},
{
"name": "crystal3",
"directions": 4
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 B

View File

@@ -0,0 +1,23 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "by malanisa (discord)",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "big"
},
{
"name": "medium"
},
{
"name": "small"
},
{
"name": "shard"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B