Ed 10 12 2024 aah (#656)

* fix ghost zlevel moving

* stairways autorotation

* ladders sprite update

* slow space swimming

* fix wrong wood spawn

* deadly ocean

* Update zLevels.yml
This commit is contained in:
Ed
2024-12-10 21:24:06 +03:00
committed by GitHub
parent 99786342fb
commit e4b60b31c0
17 changed files with 185 additions and 21 deletions

View File

@@ -108,9 +108,9 @@ public sealed class CP14SpawnRandomDemiplaneJob : Job<bool>
}
//Setup gravity
var gravity = _entManager.EnsureComponent<GravityComponent>(DemiplaneMapUid);
var gravity = _entManager.EnsureComponent<GravityComponent>(grid);
gravity.Enabled = true;
_entManager.Dirty(DemiplaneMapUid, gravity, metadata);
_entManager.Dirty(grid, gravity, metadata);
// Setup default atmos
var moles = new float[Atmospherics.AdjustedNumberOfGases];

View File

@@ -0,0 +1,17 @@
namespace Content.Server._CP14.MapDamage;
/// <summary>
/// can take damage from being directly on the map (not on the grid)
/// </summary>
[RegisterComponent, AutoGenerateComponentPause]
public sealed partial class CP14DamageableByMapComponent : Component
{
[DataField, AutoPausedField]
public TimeSpan NextDamageTime = TimeSpan.Zero;
[DataField]
public bool Enabled = false;
[DataField]
public Entity<CP14MapDamageComponent>? CurrentMap;
}

View File

@@ -0,0 +1,24 @@
using Content.Shared.Damage;
using Content.Shared.FixedPoint;
namespace Content.Server._CP14.MapDamage;
/// <summary>
/// The map deals damage to entities that are on it (not on the grid)
/// </summary>
[RegisterComponent]
public sealed partial class CP14MapDamageComponent : Component
{
//Damage every second
[DataField]
public DamageSpecifier Damage = new()
{
DamageDict = new Dictionary<string, FixedPoint2>()
{
{"Asphyxiation", 10}
}
};
[DataField]
public float StaminaDamage = 7f;
}

View File

@@ -0,0 +1,82 @@
using Content.Shared.Damage;
using Content.Shared.Damage.Systems;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Robust.Shared.Timing;
namespace Content.Server._CP14.MapDamage;
public sealed partial class CP14MapDamageSystem : EntitySystem
{
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly StaminaSystem _stamina = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CP14DamageableByMapComponent, EntParentChangedMessage>(OnParentChanged);
}
public override void Update(float frameTime)
{
base.Update(frameTime);
var query = EntityQueryEnumerator<CP14DamageableByMapComponent, DamageableComponent, MobStateComponent>();
while (query.MoveNext(out var uid, out var damage, out var damageable, out var mobState))
{
if (!damage.Enabled)
continue;
if (damage.NextDamageTime > _timing.CurTime)
continue;
damage.NextDamageTime = _timing.CurTime + TimeSpan.FromSeconds(2f);
if (damage.CurrentMap is null)
continue;
if (!_mobState.IsAlive(uid, mobState))
continue;
_damageable.TryChangeDamage(uid, damage.CurrentMap.Value.Comp.Damage, damageable: damageable);
_stamina.TakeStaminaDamage(uid, damage.CurrentMap.Value.Comp.StaminaDamage);
}
}
private void OnParentChanged(Entity<CP14DamageableByMapComponent> ent, ref EntParentChangedMessage args)
{
DisableDamage(ent);
if (args.OldParent == null || TerminatingOrDeleted(ent))
return;
var newParent = _transform.GetParentUid(ent);
if (!TryComp<CP14MapDamageComponent>(newParent, out var mapDamage))
return;
EnableDamage(ent, (newParent, mapDamage));
}
private void DisableDamage(Entity<CP14DamageableByMapComponent> ent)
{
if (!ent.Comp.Enabled)
return;
ent.Comp.Enabled = false;
ent.Comp.CurrentMap = null;
Dirty(ent);
}
private void EnableDamage(Entity<CP14DamageableByMapComponent> ent, Entity<CP14MapDamageComponent> map)
{
if (ent.Comp.Enabled)
return;
ent.Comp.Enabled = true;
ent.Comp.CurrentMap = map;
Dirty(ent);
}
}

View File

@@ -44,6 +44,7 @@ public sealed partial class CP14StationZLevelsSystem
var otherSidePortal = Spawn(autoPortal.Comp.OtherSideProto, targetMapPos);
_transform.SetWorldRotation(otherSidePortal, _transform.GetWorldRotation(autoPortal));
if (_linkedEntity.TryLink(autoPortal, otherSidePortal, true))
RemComp<CP14ZLevelAutoPortalComponent>(autoPortal);
}

View File

@@ -40,6 +40,9 @@ public sealed class CP14WallmountSystem : EntitySystem
{
base.Update(frameTime);
if (_net.IsClient)
return;
var query = EntityQueryEnumerator<CP14WallmountComponent>();
while (query.MoveNext(out var uid, out var wallmount))
{
@@ -51,8 +54,7 @@ public sealed class CP14WallmountSystem : EntitySystem
if (wallmount.AttachAttempts <= 0)
{
if (_net.IsServer)
QueueDel(uid);
QueueDel(uid);
continue;
}

View File

@@ -89,11 +89,7 @@ entities:
- visuals: CP14Rain
- visuals: CP14Storm
- visuals: CP14Mist
- type: Gravity
gravityShakeSound: !type:SoundPathSpecifier
path: /Audio/Effects/alert.ogg
inherent: True
enabled: True
- type: CP14MapDamage
- type: LoadedMap
- type: Parallax
parallax: CP14Ocean
@@ -499,6 +495,8 @@ entities:
- type: Gravity
gravityShakeSound: !type:SoundPathSpecifier
path: /Audio/Effects/alert.ogg
inherent: True
enabled: True
- type: DecalGrid
chunkCollection:
version: 2

View File

@@ -4,7 +4,10 @@
description: Move up one Z-Level
components:
- type: InstantAction
icon: _CP14/Actions/zLevel.rsi/up.png
checkCanInteract: false
icon:
sprite: _CP14/Actions/zLevel.rsi
state: up
event: !type:CP14ZLevelActionUp
- type: entity
@@ -13,5 +16,8 @@
description: Move down one Z-Level
components:
- type: InstantAction
icon: _CP14/Actions/zLevel.rsi/down.png
checkCanInteract: false
icon:
sprite: _CP14/Actions/zLevel.rsi
state: down
event: !type:CP14ZLevelActionDown

View File

@@ -229,6 +229,13 @@
- type: CanEnterCryostorage
- type: CP14IgnitionModifier
ignitionTimeModifier: 2.5
- type: CanMoveInAir # read: CanSwimInOcean lol
- type: MovementAlwaysTouching
- type: MovementSpeedModifier
weightlessAcceleration: 0.7 # Slow swimming
weightlessFriction: 3
weightlessModifier: 0.5
- type: CP14DamageableByMap
- type: entity

View File

@@ -133,7 +133,7 @@
collection: WoodDestroy
- !type:SpawnEntitiesBehavior
spawn:
MaterialWoodPlank1:
CP14WoodenPlanks1:
min: 1
max: 4
- !type:DoActsBehavior
@@ -163,7 +163,7 @@
collection: WoodDestroy
- !type:SpawnEntitiesBehavior
spawn:
MaterialWoodPlank1:
CP14WoodenPlanks1:
min: 1
max: 4
- !type:DoActsBehavior

View File

@@ -1,6 +1,6 @@
- type: entity
id: CP14DungeonEntrance
name: dungeon entrance
name: stairway down
categories: [ HideSpawnMenu ]
description: The dark depths of the underworld are calling you.
placement:
@@ -17,13 +17,13 @@
drawdepth: FloorTiles
layers:
- state: ladder
- state: down
#- state: down
- type: Fixtures
fixtures:
portalFixture:
shape:
!type:PhysShapeAabb
bounds: "-0.25,-0.48,0.25,0.48"
bounds: "-0.48,-0.48,0.48,-0.05"
mask:
- FullTileMask
layer:
@@ -36,17 +36,27 @@
- type: entity
parent: CP14DungeonEntrance
id: CP14DungeonExit
name: dungeon exit
name: stairway up
categories: [ HideSpawnMenu ]
description: A way out of the dark underworld into the overworld.
components:
- type: Sprite
noRot: true
sprite: /Textures/_CP14/Structures/Dungeon/ladders.rsi
drawdepth: FloorTiles
sprite: /Textures/_CP14/Structures/Dungeon/ladders_up.rsi
drawdepth: Mobs
layers:
- state: ladder
- state: top
#- state: top
- type: Fixtures
fixtures:
portalFixture:
shape:
!type:PhysShapeAabb
bounds: "-0.48,0.48,0.48,0.05"
mask:
- FullTileMask
layer:
- WallLayer
hard: false
- type: PointLight
color: White
radius: 3

View File

@@ -10,6 +10,7 @@
- type: MapLight
ambientLightColor: "#BFEEFFFF"
- type: CP14MapFloorOccluder
- type: CP14MapDamage
- type: Parallax
parallax: CP14Ocean
- type: CP14CloudShadows

View File

@@ -9,6 +9,7 @@
- type: MapLight
ambientLightColor: "#BFEEFFFF"
- type: CP14MapFloorOccluder
- type: CP14MapDamage
- type: Parallax
parallax: CP14Ocean
- type: CP14CloudShadows

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,15 @@
{
"version": 1,
"license": "CLA",
"copyright": "by TheShuEd (discord)",
"size": {
"x": 32,
"y": 64
},
"states": [
{
"name": "ladder",
"directions": 4
}
]
}