From e4b60b31c060074a663b9ee10c6faaf6e214fea5 Mon Sep 17 00:00:00 2001 From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Tue, 10 Dec 2024 21:24:06 +0300 Subject: [PATCH] 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 --- .../Jobs/CP14SpawnRandomDemiplaneJob.cs | 4 +- .../MapDamage/CP14DamageableByMapComponent.cs | 17 ++++ .../_CP14/MapDamage/CP14MapDamageComponent.cs | 24 +++++ .../_CP14/MapDamage/CP14MapDamageSystem.cs | 82 ++++++++++++++++++ .../CP14StationZLevelsSystem.Portals.cs | 1 + .../CP14FloorOcclusionSystem.Maps.cs | 0 .../CP14MapFloorOccluderComponent.cs | 0 .../_CP14/Wallmount/CP14WallmountSystem.cs | 6 +- Resources/Maps/_CP14/comoss.yml | 8 +- .../_CP14/Entities/Actions/zLevels.yml | 10 ++- .../_CP14/Entities/Mobs/Species/base.yml | 7 ++ .../Structures/Storage/Crates/crates.yml | 4 +- .../Entities/Structures/dungeon_entrance.yml | 26 ++++-- .../Locations/t1_grassland_island.yml | 1 + .../Locations/t1_grassland_island_ring.yml | 1 + .../Dungeon/ladders_up.rsi/ladder.png | Bin 0 -> 3164 bytes .../Dungeon/ladders_up.rsi/meta.json | 15 ++++ 17 files changed, 185 insertions(+), 21 deletions(-) create mode 100644 Content.Server/_CP14/MapDamage/CP14DamageableByMapComponent.cs create mode 100644 Content.Server/_CP14/MapDamage/CP14MapDamageComponent.cs create mode 100644 Content.Server/_CP14/MapDamage/CP14MapDamageSystem.cs rename Content.Shared/_CP14/{Movement => Map/FloorOccluder}/CP14FloorOcclusionSystem.Maps.cs (100%) rename Content.Shared/_CP14/{Movement => Map/FloorOccluder}/CP14MapFloorOccluderComponent.cs (100%) create mode 100644 Resources/Textures/_CP14/Structures/Dungeon/ladders_up.rsi/ladder.png create mode 100644 Resources/Textures/_CP14/Structures/Dungeon/ladders_up.rsi/meta.json diff --git a/Content.Server/_CP14/Demiplane/Jobs/CP14SpawnRandomDemiplaneJob.cs b/Content.Server/_CP14/Demiplane/Jobs/CP14SpawnRandomDemiplaneJob.cs index 74c9439184..f1b9030df6 100644 --- a/Content.Server/_CP14/Demiplane/Jobs/CP14SpawnRandomDemiplaneJob.cs +++ b/Content.Server/_CP14/Demiplane/Jobs/CP14SpawnRandomDemiplaneJob.cs @@ -108,9 +108,9 @@ public sealed class CP14SpawnRandomDemiplaneJob : Job } //Setup gravity - var gravity = _entManager.EnsureComponent(DemiplaneMapUid); + var gravity = _entManager.EnsureComponent(grid); gravity.Enabled = true; - _entManager.Dirty(DemiplaneMapUid, gravity, metadata); + _entManager.Dirty(grid, gravity, metadata); // Setup default atmos var moles = new float[Atmospherics.AdjustedNumberOfGases]; diff --git a/Content.Server/_CP14/MapDamage/CP14DamageableByMapComponent.cs b/Content.Server/_CP14/MapDamage/CP14DamageableByMapComponent.cs new file mode 100644 index 0000000000..a6e82d9c20 --- /dev/null +++ b/Content.Server/_CP14/MapDamage/CP14DamageableByMapComponent.cs @@ -0,0 +1,17 @@ +namespace Content.Server._CP14.MapDamage; + +/// +/// can take damage from being directly on the map (not on the grid) +/// +[RegisterComponent, AutoGenerateComponentPause] +public sealed partial class CP14DamageableByMapComponent : Component +{ + [DataField, AutoPausedField] + public TimeSpan NextDamageTime = TimeSpan.Zero; + + [DataField] + public bool Enabled = false; + + [DataField] + public Entity? CurrentMap; +} diff --git a/Content.Server/_CP14/MapDamage/CP14MapDamageComponent.cs b/Content.Server/_CP14/MapDamage/CP14MapDamageComponent.cs new file mode 100644 index 0000000000..f357319cee --- /dev/null +++ b/Content.Server/_CP14/MapDamage/CP14MapDamageComponent.cs @@ -0,0 +1,24 @@ +using Content.Shared.Damage; +using Content.Shared.FixedPoint; + +namespace Content.Server._CP14.MapDamage; + +/// +/// The map deals damage to entities that are on it (not on the grid) +/// +[RegisterComponent] +public sealed partial class CP14MapDamageComponent : Component +{ + //Damage every second + [DataField] + public DamageSpecifier Damage = new() + { + DamageDict = new Dictionary() + { + {"Asphyxiation", 10} + } + }; + + [DataField] + public float StaminaDamage = 7f; +} diff --git a/Content.Server/_CP14/MapDamage/CP14MapDamageSystem.cs b/Content.Server/_CP14/MapDamage/CP14MapDamageSystem.cs new file mode 100644 index 0000000000..316cf2f159 --- /dev/null +++ b/Content.Server/_CP14/MapDamage/CP14MapDamageSystem.cs @@ -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(OnParentChanged); + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + + var query = EntityQueryEnumerator(); + 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 ent, ref EntParentChangedMessage args) + { + DisableDamage(ent); + if (args.OldParent == null || TerminatingOrDeleted(ent)) + return; + + var newParent = _transform.GetParentUid(ent); + if (!TryComp(newParent, out var mapDamage)) + return; + + EnableDamage(ent, (newParent, mapDamage)); + } + + private void DisableDamage(Entity ent) + { + if (!ent.Comp.Enabled) + return; + + ent.Comp.Enabled = false; + ent.Comp.CurrentMap = null; + Dirty(ent); + } + + private void EnableDamage(Entity ent, Entity map) + { + if (ent.Comp.Enabled) + return; + + ent.Comp.Enabled = true; + ent.Comp.CurrentMap = map; + Dirty(ent); + } +} diff --git a/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.Portals.cs b/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.Portals.cs index 78e83fa1e9..bbdf493b78 100644 --- a/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.Portals.cs +++ b/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.Portals.cs @@ -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(autoPortal); } diff --git a/Content.Shared/_CP14/Movement/CP14FloorOcclusionSystem.Maps.cs b/Content.Shared/_CP14/Map/FloorOccluder/CP14FloorOcclusionSystem.Maps.cs similarity index 100% rename from Content.Shared/_CP14/Movement/CP14FloorOcclusionSystem.Maps.cs rename to Content.Shared/_CP14/Map/FloorOccluder/CP14FloorOcclusionSystem.Maps.cs diff --git a/Content.Shared/_CP14/Movement/CP14MapFloorOccluderComponent.cs b/Content.Shared/_CP14/Map/FloorOccluder/CP14MapFloorOccluderComponent.cs similarity index 100% rename from Content.Shared/_CP14/Movement/CP14MapFloorOccluderComponent.cs rename to Content.Shared/_CP14/Map/FloorOccluder/CP14MapFloorOccluderComponent.cs diff --git a/Content.Shared/_CP14/Wallmount/CP14WallmountSystem.cs b/Content.Shared/_CP14/Wallmount/CP14WallmountSystem.cs index d8f8941b92..27f859b4d3 100644 --- a/Content.Shared/_CP14/Wallmount/CP14WallmountSystem.cs +++ b/Content.Shared/_CP14/Wallmount/CP14WallmountSystem.cs @@ -40,6 +40,9 @@ public sealed class CP14WallmountSystem : EntitySystem { base.Update(frameTime); + if (_net.IsClient) + return; + var query = EntityQueryEnumerator(); 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; } diff --git a/Resources/Maps/_CP14/comoss.yml b/Resources/Maps/_CP14/comoss.yml index 08a83ced21..dd4047d6e6 100644 --- a/Resources/Maps/_CP14/comoss.yml +++ b/Resources/Maps/_CP14/comoss.yml @@ -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 diff --git a/Resources/Prototypes/_CP14/Entities/Actions/zLevels.yml b/Resources/Prototypes/_CP14/Entities/Actions/zLevels.yml index 0bbfee1e02..094f94bb0c 100644 --- a/Resources/Prototypes/_CP14/Entities/Actions/zLevels.yml +++ b/Resources/Prototypes/_CP14/Entities/Actions/zLevels.yml @@ -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 \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml b/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml index 933db1d4ba..26fdb0ce99 100644 --- a/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml @@ -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 diff --git a/Resources/Prototypes/_CP14/Entities/Structures/Storage/Crates/crates.yml b/Resources/Prototypes/_CP14/Entities/Structures/Storage/Crates/crates.yml index 166dc19401..d51dad9e88 100644 --- a/Resources/Prototypes/_CP14/Entities/Structures/Storage/Crates/crates.yml +++ b/Resources/Prototypes/_CP14/Entities/Structures/Storage/Crates/crates.yml @@ -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 diff --git a/Resources/Prototypes/_CP14/Entities/Structures/dungeon_entrance.yml b/Resources/Prototypes/_CP14/Entities/Structures/dungeon_entrance.yml index 2dcd28c1ca..be6d640b2c 100644 --- a/Resources/Prototypes/_CP14/Entities/Structures/dungeon_entrance.yml +++ b/Resources/Prototypes/_CP14/Entities/Structures/dungeon_entrance.yml @@ -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 diff --git a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t1_grassland_island.yml b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t1_grassland_island.yml index f068e41d1e..738848ac49 100644 --- a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t1_grassland_island.yml +++ b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t1_grassland_island.yml @@ -10,6 +10,7 @@ - type: MapLight ambientLightColor: "#BFEEFFFF" - type: CP14MapFloorOccluder + - type: CP14MapDamage - type: Parallax parallax: CP14Ocean - type: CP14CloudShadows diff --git a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t1_grassland_island_ring.yml b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t1_grassland_island_ring.yml index 47f29cc93a..3902e08b12 100644 --- a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t1_grassland_island_ring.yml +++ b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/t1_grassland_island_ring.yml @@ -9,6 +9,7 @@ - type: MapLight ambientLightColor: "#BFEEFFFF" - type: CP14MapFloorOccluder + - type: CP14MapDamage - type: Parallax parallax: CP14Ocean - type: CP14CloudShadows diff --git a/Resources/Textures/_CP14/Structures/Dungeon/ladders_up.rsi/ladder.png b/Resources/Textures/_CP14/Structures/Dungeon/ladders_up.rsi/ladder.png new file mode 100644 index 0000000000000000000000000000000000000000..7c587fd9faeb76181eea4138b0dff20323b3a29d GIT binary patch literal 3164 zcmV-i45RajP)Px>7D+@wRCt{2T;Ffo$PxZ5DU@Z#a$`v-T*E;Xr$~Z(xd4Ye2RJPd z)IodpA&P6nBJG+EB~!NSKG3rs4tJMJNr`H*jzL=OPUi2iX2xi>JI3p#GP3N_ z)9n}64(G5W&dnfP_NgF z!hoAnWgy!-ACGb}wR%1C_tkW&l`&m6m60+H0Qhn;%=z5c2KUdk^{&><>cR-Fm@>tA z9sGKdBse_|QUlPtfJ-P`2Au7ApcO@D2#_@b@eVh{R6M~VgGhPPHO_I0d2FGu31uQj zx<8pr&~C4)SpWb|kAs|S(_hPWIzH9Pn68`3NE!7qR5lbg&F{K0x?qUE4E^y>kFnyf zWXe2v@Ic${#l?lVvf)%tmLJ6Ir$k7GxVX5;DU(+|4_!G~ zp4tK|p)g_ANKP8eR_616KIX1{i$Dk{5egH^hOsX4-+liB0C%Fz)@h4E``S8#AVj;p ziudnAeJCu!Lt%MeK51Ln%;h-=QhAfHq!O+#SSEvZyB$?l1wudm^pi0ZJ~|p&8!9U+ z>)-D8@yq_cQND;=Nk(_wgzbJGdwcu&PF5m_uWy)Z%_W=O1 zp)iqyjgX4qLQpak9!Fs=G^TzL=$>inlOQ==9UQq(c-|FX`M1sxG8BIK>a~*H+uO%D z3bj)s-EXx!c=DvL?(>KC{@u^2KEm$qha36qw7B#3O}Z>jp)l{T$q*Fb$$zefp=*32 zhPV0TNgu6tM-6Mq?xZ-coBpRVK@e)gdft~HNJoP;64X7#Sypw6_t^jqE= zMl?ap{^D^|Cd_D*Q zbh}+;lyMYd5QW%!@+?`?dM+(z#0(D+Te5Nw8EP)Io<<+|YkcNl^mw@7z z{e5_zR~Y_MeLPV4>)(D<_rCl72Q@-=chl+VmgJscclQHczItsm;`?`@B1S&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