From 3affd1118e579025a514c7b6ce097f1a4ec05d04 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Tue, 16 Mar 2021 12:55:35 +0100 Subject: [PATCH] Improves FlammableComponent, allow mobs to collide with each other. --- .../Components/Atmos/FlammableComponent.cs | 22 ++++++++++++++++--- .../Movement/SharedPlayerMobMoverComponent.cs | 9 ++++---- Resources/Changelog/Parts/fire_passing.yml | 4 ++++ Resources/Changelog/Parts/flammable.yml | 4 ++++ .../Entities/Mobs/Species/human.yml | 4 ++-- 5 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 Resources/Changelog/Parts/fire_passing.yml create mode 100644 Resources/Changelog/Parts/flammable.yml diff --git a/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs b/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs index a4553854ad..bde846aa6e 100644 --- a/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +using System.Threading.Tasks; using Content.Server.Atmos; +using Content.Server.GameObjects.Components.Interactable; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Temperature; using Content.Shared.Alert; @@ -24,7 +26,7 @@ using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.Atmos { [RegisterComponent] - public class FlammableComponent : SharedFlammableComponent, IStartCollide, IFireAct, IReagentReaction + public class FlammableComponent : SharedFlammableComponent, IStartCollide, IFireAct, IReagentReaction, IInteractUsing { private bool _resisting = false; private readonly List _collided = new(); @@ -67,7 +69,7 @@ namespace Content.Server.GameObjects.Components.Atmos public void AdjustFireStacks(float relativeFireStacks) { - FireStacks = MathF.Max(MathF.Min(-10f, FireStacks + relativeFireStacks), 20f); + FireStacks = MathF.Min(MathF.Max(-10f, FireStacks + relativeFireStacks), 20f); if (OnFire && FireStacks <= 0) Extinguish(); @@ -199,7 +201,7 @@ namespace Content.Server.GameObjects.Components.Atmos Owner.SpawnTimer(2000, () => { _resisting = false; - FireStacks -= 2f; + FireStacks -= 3f; UpdateAppearance(); }); } @@ -224,5 +226,19 @@ namespace Content.Server.GameObjects.Components.Atmos return ReagentUnit.Zero; } } + + public async Task InteractUsing(InteractUsingEventArgs eventArgs) + { + foreach (var hotItem in eventArgs.Using.GetAllComponents()) + { + if (hotItem.IsCurrentlyHot()) + { + Ignite(); + return true; + } + } + + return false; + } } } diff --git a/Content.Shared/GameObjects/Components/Movement/SharedPlayerMobMoverComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedPlayerMobMoverComponent.cs index 35f739e8c4..e541f038f8 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedPlayerMobMoverComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedPlayerMobMoverComponent.cs @@ -116,10 +116,11 @@ namespace Content.Shared.GameObjects.Components.Movement { // Don't collide with other mobs // unless they have combat mode on - return collidedWith.Entity.HasComponent(); /* && - (!Owner.TryGetComponent(out SharedCombatModeComponent? ownerCombat) || !ownerCombat.IsInCombatMode) && - (!collidedWith.Entity.TryGetComponent(out SharedCombatModeComponent? otherCombat) || !otherCombat.IsInCombatMode); - */ + return false; //collidedWith.Entity.HasComponent(); + /* && + (!Owner.TryGetComponent(out SharedCombatModeComponent? ownerCombat) || !ownerCombat.IsInCombatMode) && + (!collidedWith.Entity.TryGetComponent(out SharedCombatModeComponent? otherCombat) || !otherCombat.IsInCombatMode); + */ } [Serializable, NetSerializable] diff --git a/Resources/Changelog/Parts/fire_passing.yml b/Resources/Changelog/Parts/fire_passing.yml new file mode 100644 index 0000000000..5c03dde724 --- /dev/null +++ b/Resources/Changelog/Parts/fire_passing.yml @@ -0,0 +1,4 @@ +author: Zumorica +changes: + - type: Add + message: Passing by someone who is on fire will now set you on fire as well. diff --git a/Resources/Changelog/Parts/flammable.yml b/Resources/Changelog/Parts/flammable.yml new file mode 100644 index 0000000000..33b93ba8ad --- /dev/null +++ b/Resources/Changelog/Parts/flammable.yml @@ -0,0 +1,4 @@ +author: Zumorica +changes: + - type: Add + message: You can now spray people with flammable chemicals and ignite them with a welding tool or anything similar. diff --git a/Resources/Prototypes/Entities/Mobs/Species/human.yml b/Resources/Prototypes/Entities/Mobs/Species/human.yml index c7f9117bc3..dc5db2b3af 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/human.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/human.yml @@ -118,10 +118,10 @@ - type: Physics bodyType: KinematicController mass: 70 - fixtures: + fixtures: # TODO: This needs a second fixture just for mob collisions. - shape: !type:PhysShapeCircle - radius: 0.35 + radius: 0.35 restitution: 0.0 mask: - Impassable