diff --git a/Content.Server/EntityEffects/Effects/AreaReactionEffect.cs b/Content.Server/EntityEffects/Effects/AreaReactionEffect.cs index 481f1fc27c5da2..858da2b360569d 100644 --- a/Content.Server/EntityEffects/Effects/AreaReactionEffect.cs +++ b/Content.Server/EntityEffects/Effects/AreaReactionEffect.cs @@ -1,4 +1,5 @@ using Content.Server.Fluids.EntitySystems; +using Content.Server.Spreader; using Content.Shared.Audio; using Content.Shared.Coordinates.Helpers; using Content.Shared.Database; @@ -64,16 +65,19 @@ public override void Effect(EntityEffectBaseArgs args) var transform = reagentArgs.EntityManager.GetComponent(reagentArgs.TargetEntity); var mapManager = IoCManager.Resolve(); var mapSys = reagentArgs.EntityManager.System(); - var sys = reagentArgs.EntityManager.System(); + var spreaderSys = args.EntityManager.System(); + var sys = args.EntityManager.System(); var mapCoords = sys.GetMapCoordinates(reagentArgs.TargetEntity, xform: transform); if (!mapManager.TryFindGridAt(mapCoords, out var gridUid, out var grid) || - !mapSys.TryGetTileRef(gridUid, grid, transform.Coordinates, out var tileRef) || - tileRef.Tile.IsSpace()) + !mapSys.TryGetTileRef(gridUid, grid, transform.Coordinates, out var tileRef)) { return; } + if (spreaderSys.RequiresFloorToSpread(_prototypeId) && tileRef.Tile.IsSpace()) + return; + var coords = mapSys.MapToGrid(gridUid, mapCoords); var ent = reagentArgs.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid()); diff --git a/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs b/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs index f958373ac74f00..3d3c5d85630c02 100644 --- a/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs @@ -1,6 +1,7 @@ using Content.Shared.Explosion.Components; using Content.Shared.Explosion.EntitySystems; using Content.Server.Fluids.EntitySystems; +using Content.Server.Spreader; using Content.Shared.Chemistry.Components; using Content.Shared.Coordinates.Helpers; using Content.Shared.Maps; @@ -17,6 +18,7 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem [Dependency] private readonly IMapManager _mapMan = default!; [Dependency] private readonly SmokeSystem _smoke = default!; [Dependency] private readonly TransformSystem _transform = default!; + [Dependency] private readonly SpreaderSystem _spreader = default!; public override void Initialize() { @@ -31,11 +33,14 @@ private void OnTrigger(EntityUid uid, SmokeOnTriggerComponent comp, TriggerEvent var mapCoords = _transform.GetMapCoordinates(uid, xform); if (!_mapMan.TryFindGridAt(mapCoords, out _, out var grid) || !grid.TryGetTileRef(xform.Coordinates, out var tileRef) || - tileRef.Tile.IsSpace()) + tileRef.Tile.IsEmpty) { return; } + if (_spreader.RequiresFloorToSpread(comp.SmokePrototype.ToString()) && tileRef.Tile.IsSpace()) + return; + var coords = grid.MapToGrid(mapCoords); var ent = Spawn(comp.SmokePrototype, coords.SnapToGrid()); if (!TryComp(ent, out var smoke)) diff --git a/Content.Server/Spreader/SpreaderSystem.cs b/Content.Server/Spreader/SpreaderSystem.cs index 7de8a43d354ff4..50f5d81183b6d3 100644 --- a/Content.Server/Spreader/SpreaderSystem.cs +++ b/Content.Server/Spreader/SpreaderSystem.cs @@ -2,6 +2,7 @@ using Content.Server.Atmos.EntitySystems; using Content.Server.Shuttles.Components; using Content.Shared.Atmos; +using Content.Shared.Maps; using Content.Shared.Spreader; using Content.Shared.Tag; using Robust.Shared.Collections; @@ -175,11 +176,12 @@ private void Spread(EntityUid uid, TransformComponent xform, ProtoId public void GetNeighbors(EntityUid uid, TransformComponent comp, ProtoId prototype, out ValueList<(MapGridComponent, TileRef)> freeTiles, out ValueList occupiedTiles, out ValueList neighbors) { - // TODO remove occupiedTiles -- its currently unused and just slows this method down. - DebugTools.Assert(_prototype.HasIndex(prototype)); freeTiles = []; occupiedTiles = []; neighbors = []; + // TODO remove occupiedTiles -- its currently unused and just slows this method down. + if (!_prototype.TryIndex(prototype, out var spreaderPrototype)) + return; if (!TryComp(comp.GridUid, out var grid)) return; @@ -244,6 +246,9 @@ public void GetNeighbors(EntityUid uid, TransformComponent comp, ProtoId spreader) + { + if (!_prototype.Index(spreader).TryGetComponent(out var spreaderComp, EntityManager.ComponentFactory)) + return false; + + return _prototype.Index(spreaderComp.Id).PreventSpreadOnSpaced; + } } diff --git a/Content.Shared/Spreader/EdgeSpreaderPrototype.cs b/Content.Shared/Spreader/EdgeSpreaderPrototype.cs index fee8f93a6d3c46..33665d82b5dff6 100644 --- a/Content.Shared/Spreader/EdgeSpreaderPrototype.cs +++ b/Content.Shared/Spreader/EdgeSpreaderPrototype.cs @@ -10,4 +10,10 @@ public sealed partial class EdgeSpreaderPrototype : IPrototype { [IdDataField] public string ID { get; } = string.Empty; [DataField(required:true)] public int UpdatesPerSecond; + + /// + /// If true, this spreader can't spread onto spaced tiles like lattice. + /// + [DataField] + public bool PreventSpreadOnSpaced = true; } diff --git a/Content.Shared/Tiles/ReplaceFloorOnSpawnComponent.cs b/Content.Shared/Tiles/ReplaceFloorOnSpawnComponent.cs new file mode 100644 index 00000000000000..1b87082defad73 --- /dev/null +++ b/Content.Shared/Tiles/ReplaceFloorOnSpawnComponent.cs @@ -0,0 +1,36 @@ +using Content.Shared.Maps; +using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; + +namespace Content.Shared.Tiles; + +/// +/// Replaces floor tiles around this entity when it spawns +/// +[RegisterComponent, NetworkedComponent, Access(typeof(ReplaceFloorOnSpawnSystem))] +public sealed partial class ReplaceFloorOnSpawnComponent : Component +{ + /// + /// The floor tiles that will be replaced. If null, will replace all. + /// + [DataField] + public List>? ReplaceableTiles = new(); + + /// + /// The tiles that it will replace. Randomly picked from the list. + /// + [DataField] + public List> ReplacementTiles = new(); + + /// + /// Whether or not there has to be a tile in the location to be replaced. + /// + [DataField] + public bool ReplaceSpace = true; + + /// + /// List of offsets from the base tile, used to determine which tiles will be replaced. + /// + [DataField] + public List Offsets = new() { Vector2i.Up, Vector2i.Down, Vector2i.Left, Vector2i.Right, Vector2i.Zero }; +} diff --git a/Content.Shared/Tiles/ReplaceFloorOnSpawnSystem.cs b/Content.Shared/Tiles/ReplaceFloorOnSpawnSystem.cs new file mode 100644 index 00000000000000..818991f823dd79 --- /dev/null +++ b/Content.Shared/Tiles/ReplaceFloorOnSpawnSystem.cs @@ -0,0 +1,48 @@ +using Robust.Shared.Map; +using Robust.Shared.Map.Components; +using Robust.Shared.Prototypes; +using Robust.Shared.Random; + +namespace Content.Shared.Tiles; + +public sealed class ReplaceFloorOnSpawnSystem : EntitySystem +{ + [Dependency] private readonly ITileDefinitionManager _tile = default!; + [Dependency] private readonly IPrototypeManager _prototype = default!; + [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly SharedMapSystem _map = default!; + + /// + public override void Initialize() + { + SubscribeLocalEvent(OnMapInit); + } + + private void OnMapInit(Entity ent, ref MapInitEvent args) + { + var xform = Transform(ent); + if (xform.GridUid is not { } grid || !TryComp(grid, out var gridComp)) + return; + + if (ent.Comp.ReplaceableTiles != null && ent.Comp.ReplaceableTiles.Count == 0) + return; + + var tileIndices = _map.LocalToTile(grid, gridComp, xform.Coordinates); + + foreach (var offset in ent.Comp.Offsets) + { + var actualIndices = tileIndices + offset; + + if (!_map.TryGetTileRef(grid, gridComp, actualIndices, out var tile)) + continue; + + if (ent.Comp.ReplaceableTiles != null && + !tile.Tile.IsEmpty && + !ent.Comp.ReplaceableTiles.Contains(_tile[tile.Tile.TypeId].ID)) + continue; + + var tileToSet = _random.Pick(ent.Comp.ReplacementTiles); + _map.SetTile(grid, gridComp, tile.GridIndices, new Tile(_prototype.Index(tileToSet).TileId)); + } + } +} diff --git a/Resources/Locale/en-US/tiles/tiles.ftl b/Resources/Locale/en-US/tiles/tiles.ftl index e5b6810fcab7e0..35cea19f7862e6 100644 --- a/Resources/Locale/en-US/tiles/tiles.ftl +++ b/Resources/Locale/en-US/tiles/tiles.ftl @@ -87,6 +87,7 @@ tiles-gold-tile = gold tile tiles-silver-tile = silver tile tiles-glass-floor = glass floor tiles-reinforced-glass-floor = reinforced glass floor +tiles-metal-foam = metal foam floor tiles-green-circuit-floor = green circuit floor tiles-blue-circuit-floor = blue circuit floor tiles-snow = snow @@ -126,4 +127,4 @@ tiles-mowed-astro-grass = mowed astro-grass tiles-jungle-astro-grass = jungle astro-grass tiles-astro-ice = astro-ice tiles-astro-snow = astro-snow -tiles-wood-large = large wood \ No newline at end of file +tiles-wood-large = large wood diff --git a/Resources/Prototypes/Catalog/Cargo/cargo_engineering.yml b/Resources/Prototypes/Catalog/Cargo/cargo_engineering.yml index 7ca6af84518d53..d4e2b4c60dc8a6 100644 --- a/Resources/Prototypes/Catalog/Cargo/cargo_engineering.yml +++ b/Resources/Prototypes/Catalog/Cargo/cargo_engineering.yml @@ -28,6 +28,16 @@ category: cargoproduct-category-name-engineering group: market +- type: cargoProduct + id: EngineeringFoamGrenade + icon: + sprite: Objects/Weapons/Grenades/metalfoam.rsi + state: icon + product: CrateEngineeringFoamGrenade + cost: 2500 + category: cargoproduct-category-name-engineering + group: market + - type: cargoProduct id: EngineeringCableBulk icon: diff --git a/Resources/Prototypes/Catalog/Fills/Crates/engineering.yml b/Resources/Prototypes/Catalog/Fills/Crates/engineering.yml index 26a8910c735e95..62d07b0beda278 100644 --- a/Resources/Prototypes/Catalog/Fills/Crates/engineering.yml +++ b/Resources/Prototypes/Catalog/Fills/Crates/engineering.yml @@ -76,6 +76,17 @@ - id: CableHVStack amount: 3 +- type: entity + id: CrateEngineeringFoamGrenade + parent: CrateEngineeringSecure + name: sealant grenade crate + description: 5 metal foam sealant grenades. + components: + - type: StorageFill + contents: + - id: MetalFoamGrenade + amount: 5 + - type: entity id: CrateEngineeringCableBulk parent: CrateElectrical diff --git a/Resources/Prototypes/Entities/Effects/chemistry_effects.yml b/Resources/Prototypes/Entities/Effects/chemistry_effects.yml index 096e88bcb6fef0..ee300e9aeafff5 100644 --- a/Resources/Prototypes/Entities/Effects/chemistry_effects.yml +++ b/Resources/Prototypes/Entities/Effects/chemistry_effects.yml @@ -101,6 +101,8 @@ state: m_foam-north - map: [ "enum.EdgeLayer.West" ] state: m_foam-west + - type: EdgeSpreader + id: MetalFoam - type: FoamVisuals animationTime: 0.6 animationState: m_foam-dissolve @@ -135,7 +137,7 @@ - type: RCDDeconstructable cost: 2 delay: 2 - fx: EffectRCDDeconstruct2 + fx: EffectRCDDeconstruct2 - type: Clickable - type: InteractionOutline - type: Sprite @@ -159,6 +161,13 @@ - type: Transform anchored: true - type: Airtight + - type: ReplaceFloorOnSpawn + replaceableTiles: + - Plating + - Lattice + - TrainLattice + replacementTiles: + - FloorMetalFoam - type: Damageable damageContainer: Inorganic damageModifierSet: Metallic diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml index b1d260c32761f1..eb382c01e5fc57 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml @@ -422,6 +422,21 @@ - ReagentId: TearGas Quantity: 50 +- type: entity + parent: SmokeGrenade + id: MetalFoamGrenade + name: metal foam grenade + description: An emergency tool used for patching up holes. Almost as good as real walls. + components: + - type: Sprite + sprite: Objects/Weapons/Grenades/metalfoam.rsi + - type: SmokeOnTrigger + duration: 10 + spreadAmount: 13 + smokePrototype: AluminiumMetalFoam + - type: StaticPrice + price: 350 + # Non-explosive "dummy" grenades to use as a distraction. - type: entity diff --git a/Resources/Prototypes/Tiles/floors.yml b/Resources/Prototypes/Tiles/floors.yml index 602e9bc441cc8e..91b61bec0942c1 100644 --- a/Resources/Prototypes/Tiles/floors.yml +++ b/Resources/Prototypes/Tiles/floors.yml @@ -201,7 +201,7 @@ collection: FootstepHull itemDrop: FloorTileItemBrassFilled heatCapacity: 10000 - + - type: tile id: FloorBrassReebe name: tiles-brass-floor-reebe @@ -1391,6 +1391,21 @@ itemDrop: SheetRGlass1 heatCapacity: 10000 +- type: tile + id: FloorMetalFoam + name: tiles-metal-foam + sprite: /Textures/Tiles/foammetal.png + variants: 1 + placementVariants: + - 1.0 + baseTurf: Plating + isSubfloor: false + deconstructTools: [ Prying ] + footstepSounds: + collection: FootstepHull + itemDrop: SheetSteel1 + heatCapacity: 10000 + # Circuits - type: tile id: FloorGreenCircuit diff --git a/Resources/Prototypes/edge_spreaders.yml b/Resources/Prototypes/edge_spreaders.yml index 061932c706db3c..c93cc02ba9774e 100644 --- a/Resources/Prototypes/edge_spreaders.yml +++ b/Resources/Prototypes/edge_spreaders.yml @@ -9,3 +9,8 @@ - type: edgeSpreader id: Smoke updatesPerSecond: 8 + +- type: edgeSpreader + id: MetalFoam + updatesPerSecond: 16 + preventSpreadOnSpaced: false diff --git a/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/equipped-BELT.png b/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/equipped-BELT.png new file mode 100644 index 00000000000000..d3cf1cf4c9329b Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/equipped-BELT.png differ diff --git a/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/icon.png b/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/icon.png new file mode 100644 index 00000000000000..a13dedfc2052c6 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/icon.png differ diff --git a/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/meta.json b/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/meta.json new file mode 100644 index 00000000000000..139eebb04da79d --- /dev/null +++ b/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/meta.json @@ -0,0 +1,27 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Created by EmoGarbage404", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "primed", + "delays": [ + [ + 0.2, + 0.1 + ] + ] + }, + { + "name": "equipped-BELT", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/primed.png b/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/primed.png new file mode 100644 index 00000000000000..dafc378c3bca93 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Grenades/metalfoam.rsi/primed.png differ diff --git a/Resources/Textures/Tiles/attributions.yml b/Resources/Textures/Tiles/attributions.yml index 7cfe5535a0aff3..6a6f545d1e9fea 100644 --- a/Resources/Textures/Tiles/attributions.yml +++ b/Resources/Textures/Tiles/attributions.yml @@ -16,11 +16,11 @@ copyright: "Modified by github user @Flareguy from plating.png, using damaged plating sprites from /tg/station at commit https://github.com/tgstation/tgstation/blob/6665eec76c98a4f3f89bebcd10b34b47dcc0b8ae/icons/turf/floors.dmi" source: "https://github.com/space-wizards/space-station-14/pull/21711" -- files: [ "asteroid_red.png", "asteroid_tile.png", "elevator_shaft.png", "freezer.png", "green_circuit.png", "lino.png", "mono.png", "rock_vault.png", "showroom.png"] +- files: [ "asteroid_red.png", "asteroid_tile.png", "elevator_shaft.png", "freezer.png", "foammetal.png", "green_circuit.png", "lino.png", "mono.png", "rock_vault.png", "showroom.png"] license: "CC-BY-SA-3.0" copyright: "vgstation13 at roughly commit e4d3ea7f69d21c3667be12b114fa935c4640cb05, asteroid_red and asteroid_tile taken from commit /vg/station at commit 02b9f6894af4419c9f7e699a22c402b086d8067e." source: "https://github.com/vgstation-coders/vgstation13" - + - files: [ "asteroid.png", "asteroid_dug.png", "asteroid0.png"] license: "CC-BY-SA-3.0" copyright: "Taken from /tg/station at commit 6665eec76c98a4f3f89bebcd10b34b47dcc0b8ae." @@ -40,7 +40,7 @@ license: "CC-BY-SA-3.0" copyright: "Modified from plating.png by github user @Flareguy" source: "https://github.com/space-wizards/space-station-14/" - + - files: ["rglass.png"] license: "CC-BY-SA-3.0" copyright: "tgstation commit 8abb19545828230d92ba18827feeb42a67a55d49, rglass modified by github user @notquitehadouken." @@ -90,7 +90,7 @@ license: "CC-BY-SA-3.0" copyright: "Fortuna commit 2a9408a47e2f83d945335e4feeeeafb552173e6f, grasslight and dirt by Peptide based on grassdark.png and dirt." source: "https://github.com/FortunaSS13/Fortuna" - + - files: ["steel_maint.png", "grating_maint.png", "wood_tile.png"] license: "CC-BY-SA-3.0" copyright: "by brainfood for space-station-14, ." @@ -105,7 +105,7 @@ license: "CC-BY-SA-3.0" copyright: "taken at https://github.com/ParadiseSS13/Paradise/blob/8b7f4c8b69c74c6de5a755272eb8d3520f3d87c7/icons/turf/floors.dmi" source: "https://github.com/ParadiseSS13/Paradise" - + - files: ["chromite.png"] license: "CC-BY-NC-SA-3.0" copyright: "taken at commit 0587dd16e28108bdf0b0a28e2caae4319845e861, and recolored by TheShuEd" diff --git a/Resources/Textures/Tiles/foammetal.png b/Resources/Textures/Tiles/foammetal.png new file mode 100644 index 00000000000000..a6afd53b25a541 Binary files /dev/null and b/Resources/Textures/Tiles/foammetal.png differ