diff --git a/Content.Server/Atmos/Components/FlammableComponent.cs b/Content.Server/Atmos/Components/FlammableComponent.cs index 9ae99a15136e..b94047b50841 100644 --- a/Content.Server/Atmos/Components/FlammableComponent.cs +++ b/Content.Server/Atmos/Components/FlammableComponent.cs @@ -82,5 +82,12 @@ public sealed partial class FlammableComponent : Component [DataField] public ProtoId FireAlert = "Fire"; + + // imp edit + /// + /// Should the entity enable an AmbientSound component when lit, and disable it when unlit? + /// + [DataField] + public bool ToggleAmbientSound; } } diff --git a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs index bc96807af2db..1a5924c3b1dc 100644 --- a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs +++ b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs @@ -1,5 +1,6 @@ using Content.Server.Administration.Logs; using Content.Server.Atmos.Components; +using Content.Server.Audio; using Content.Server.IgnitionSource; using Content.Server.Stunnable; using Content.Server.Temperature.Components; @@ -9,6 +10,7 @@ using Content.Shared.Alert; using Content.Shared.Atmos; using Content.Shared.Atmos.Components; +using Content.Shared.Audio; using Content.Shared.Damage; using Content.Shared.Database; using Content.Shared.Interaction; @@ -24,6 +26,7 @@ using Content.Shared.Weapons.Melee.Events; using Content.Shared.FixedPoint; using Robust.Server.Audio; +using Robust.Shared.Physics; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Events; using Robust.Shared.Physics.Systems; @@ -47,6 +50,7 @@ public sealed class FlammableSystem : EntitySystem [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly UseDelaySystem _useDelay = default!; [Dependency] private readonly AudioSystem _audio = default!; + [Dependency] private readonly AmbientSoundSystem _ambient = default!; [Dependency] private readonly IRobustRandom _random = default!; private EntityQuery _inventoryQuery; @@ -137,6 +141,10 @@ private void OnMapInit(EntityUid uid, FlammableComponent component, MapInitEvent _fixture.TryCreateFixture(uid, component.FlammableCollisionShape, component.FlammableFixtureID, hard: false, collisionMask: (int) CollisionGroup.FullTileLayer, body: body); + + // imp edit, disables AmbientSound if it's meant to be handled with a toggle + if (component.ToggleAmbientSound && TryComp(uid, out var ambient)) + _ambient.SetAmbience(uid, false, ambient); } private void OnInteractUsing(EntityUid uid, FlammableComponent flammable, InteractUsingEvent args) @@ -211,8 +219,14 @@ private void OnCollide(EntityUid uid, FlammableComponent flammable, ref StartCol var mass2 = 1f; if (_physicsQuery.TryComp(uid, out var physics) && _physicsQuery.TryComp(otherUid, out var otherPhys)) { - mass1 = physics.Mass; - mass2 = otherPhys.Mass; + // imp edit - if either entity has a static BodyType then it has no mass, so just equalise instead + var anyStatic = physics.BodyType == BodyType.Static || otherPhys.BodyType == BodyType.Static; + + if (!anyStatic) + { + mass1 = physics.Mass; + mass2 = otherPhys.Mass; + } } // when the thing on fire is more massive than the other, the following happens: @@ -315,6 +329,10 @@ public void Extinguish(EntityUid uid, FlammableComponent? flammable = null) _ignitionSourceSystem.SetIgnited(uid, false); + // imp edit + if (flammable.ToggleAmbientSound && TryComp(uid, out var ambient)) + _ambient.SetAmbience(uid, false, ambient); + UpdateAppearance(uid, flammable); } @@ -338,6 +356,12 @@ public void Ignite(EntityUid uid, EntityUid ignitionSource, FlammableComponent? flammable.OnFire = true; } + // imp edit + if (flammable.ToggleAmbientSound && + TryComp(uid, out var ambient) && + !ambient.Enabled) + _ambient.SetAmbience(uid, true, ambient); + UpdateAppearance(uid, flammable); } diff --git a/Resources/Prototypes/Entities/Structures/Decoration/bonfire.yml b/Resources/Prototypes/Entities/Structures/Decoration/bonfire.yml index b60b2bd94359..cf0255244515 100644 --- a/Resources/Prototypes/Entities/Structures/Decoration/bonfire.yml +++ b/Resources/Prototypes/Entities/Structures/Decoration/bonfire.yml @@ -1,45 +1,119 @@ +# imp edit - base bonfire so legionnaire bonfire and other static bonfires can parent off this - type: entity - id: Bonfire + id: BonfireBase parent: BaseStructure name: bonfire description: What can be better than a late evening under the sky with guitar and friends? + abstract: true components: - type: Sprite noRot: true sprite: Structures/Decoration/bonfire.rsi layers: - - state: bonfire - - state: burning - - type: PointLight - radius: 5 - energy: 3 - color: "#FFC90C" + - state: bonfire + - state: burning - type: Damageable damageContainer: StructuralInorganic damageModifierSet: Wood + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 50 + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] + - type: AmbientSound + volume: -5 + range: 5 + sound: + path: /Audio/Ambience/Objects/fireplace.ogg + +# imp edit - most of these components are new, with old ones rolled into BaseBonfire. and yet, we are still in an upstream file +- type: entity + id: Bonfire + parent: BonfireBase + name: bonfire + description: What can be better than a late evening under the sky with guitar and friends? + components: + - type: Sprite + layers: + - state: bonfire + - type: Appearance + - type: Fixtures + fixtures: + fix1: + shape: + !type:PhysShapeCircle + radius: 0.35 + density: 130 + mask: + - MachineMask + layer: + - MidImpassable + - LowImpassable - type: Destructible thresholds: + - trigger: + !type:DamageTrigger + damage: 100 + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] - trigger: !type:DamageTrigger damage: 50 behaviors: - !type:DoActsBehavior acts: [ "Destruction" ] - - type: AmbientSound - volume: -5 - range: 5 - sound: - path: /Audio/Ambience/Objects/fireplace.ogg - - type: AlwaysHot + - !type:PlaySoundBehavior + sound: + collection: WoodDestroy + - !type:SpawnEntitiesBehavior + spawn: + MaterialWoodPlank1: + min: 6 + max: 10 + - type: Reactive + groups: + Flammable: [ Touch ] + Extinguish: [ Touch ] + - type: Climbable + - type: Flammable + damage: + types: + Heat: 0 # adding any damage would make it break loudly into pieces, which feels weird + flammableCollisionShape: + !type:PhysShapeCircle + radius: 0.25 + maximumFireStacks: 6 + fireSpread: true + alwaysCombustible: true + firestacksOnIgnite: 2 + firestackFade: 0.05 # gets hotter the longer it's on + toggleAmbientSound: true + - type: FireVisuals + sprite: Structures/Decoration/bonfire.rsi + normalState: burning + maxLightRadius: 8 + maxLightEnergy: 5 + - type: Construction + graph: Bonfire + node: bonfire - type: entity id: LegionnaireBonfire - parent: Bonfire + parent: BonfireBase name: legionnaire bonfire description: There, in the land of lava and ash, place to to cook marshmallow and potato. components: - type: Sprite layers: - state: legionnaire_bonfire + # imp edits - type: PointLight + radius: 5 + energy: 3 color: "#FF5601" + - type: AlwaysHot + # end imp edits diff --git a/Resources/Prototypes/_Impstation/Recipes/Construction/Graphs/structures/bonfire.yml b/Resources/Prototypes/_Impstation/Recipes/Construction/Graphs/structures/bonfire.yml new file mode 100644 index 000000000000..584af6a2dfba --- /dev/null +++ b/Resources/Prototypes/_Impstation/Recipes/Construction/Graphs/structures/bonfire.yml @@ -0,0 +1,25 @@ +- type: constructionGraph + id: Bonfire + start: start + graph: + - node: start + edges: + - to: bonfire + steps: + - material: WoodPlank + amount: 10 + doAfter: 6 + - node: bonfire + entity: Bonfire + actions: + - !type:SnapToGrid {} + edges: + - to: start + completed: + - !type:SpawnPrototype + prototype: MaterialWoodPlank1 + amount: 10 + - !type:DeleteEntity {} + steps: + - tool: Prying + doAfter: 3 diff --git a/Resources/Prototypes/_Impstation/Recipes/Construction/structures.yml b/Resources/Prototypes/_Impstation/Recipes/Construction/structures.yml index d19416a9fb55..a7fe1aa7a55f 100644 --- a/Resources/Prototypes/_Impstation/Recipes/Construction/structures.yml +++ b/Resources/Prototypes/_Impstation/Recipes/Construction/structures.yml @@ -32,4 +32,21 @@ sprite: Structures/Windows/directional.rsi state: uranium_reinforced_window objectType: Structure - placementMode: SnapgridCenter \ No newline at end of file + placementMode: SnapgridCenter + +- type: construction + id: Bonfire + name: bonfire + description: What can be better than a late evening under the sky with guitar and friends? + graph: Bonfire + startNode: start + targetNode: bonfire + category: construction-category-structures + objectType: Structure + placementMode: SnapgridCenter + canBuildInImpassable: false + icon: + sprite: Structures/Decoration/bonfire.rsi + state: bonfire + conditions: + - !type:TileNotBlocked diff --git a/Resources/Textures/Structures/Decoration/bonfire.rsi/bonfire_extinguished.png b/Resources/Textures/Structures/Decoration/bonfire.rsi/bonfire_extinguished.png index f0600a8ce2ba..5b6b5f3ee508 100644 Binary files a/Resources/Textures/Structures/Decoration/bonfire.rsi/bonfire_extinguished.png and b/Resources/Textures/Structures/Decoration/bonfire.rsi/bonfire_extinguished.png differ diff --git a/Resources/Textures/Structures/Decoration/bonfire.rsi/burning.png b/Resources/Textures/Structures/Decoration/bonfire.rsi/burning.png index 4f5e2fc12699..302741abf9a3 100644 Binary files a/Resources/Textures/Structures/Decoration/bonfire.rsi/burning.png and b/Resources/Textures/Structures/Decoration/bonfire.rsi/burning.png differ diff --git a/Resources/Textures/Structures/Decoration/bonfire.rsi/meta.json b/Resources/Textures/Structures/Decoration/bonfire.rsi/meta.json index a30ea680c5d6..56379d67d04b 100644 --- a/Resources/Textures/Structures/Decoration/bonfire.rsi/meta.json +++ b/Resources/Textures/Structures/Decoration/bonfire.rsi/meta.json @@ -1,7 +1,7 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "Taken from /tg/station at commit 28b476ab6d17014e6f9e18a748d7c96be28de9a1", + "copyright": "Taken from /tg/station at commit 28b476ab6d17014e6f9e18a748d7c96be28de9a1, extinguished/burning edited by Darkmajia", "size": { "x": 32, "y": 32