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 0000000000..7c587fd9fa Binary files /dev/null and b/Resources/Textures/_CP14/Structures/Dungeon/ladders_up.rsi/ladder.png differ diff --git a/Resources/Textures/_CP14/Structures/Dungeon/ladders_up.rsi/meta.json b/Resources/Textures/_CP14/Structures/Dungeon/ladders_up.rsi/meta.json new file mode 100644 index 0000000000..82745c39de --- /dev/null +++ b/Resources/Textures/_CP14/Structures/Dungeon/ladders_up.rsi/meta.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "license": "CLA", + "copyright": "by TheShuEd (discord)", + "size": { + "x": 32, + "y": 64 + }, + "states": [ + { + "name": "ladder", + "directions": 4 + } + ] +}