Improves FlammableComponent, allow mobs to collide with each other.

This commit is contained in:
Vera Aguilera Puerto
2021-03-16 12:55:35 +01:00
parent b4493575cc
commit 3affd1118e
5 changed files with 34 additions and 9 deletions

View File

@@ -1,6 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
using Content.Server.Atmos; using Content.Server.Atmos;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Temperature; using Content.Server.GameObjects.Components.Temperature;
using Content.Shared.Alert; using Content.Shared.Alert;
@@ -24,7 +26,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Atmos namespace Content.Server.GameObjects.Components.Atmos
{ {
[RegisterComponent] [RegisterComponent]
public class FlammableComponent : SharedFlammableComponent, IStartCollide, IFireAct, IReagentReaction public class FlammableComponent : SharedFlammableComponent, IStartCollide, IFireAct, IReagentReaction, IInteractUsing
{ {
private bool _resisting = false; private bool _resisting = false;
private readonly List<EntityUid> _collided = new(); private readonly List<EntityUid> _collided = new();
@@ -67,7 +69,7 @@ namespace Content.Server.GameObjects.Components.Atmos
public void AdjustFireStacks(float relativeFireStacks) 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) if (OnFire && FireStacks <= 0)
Extinguish(); Extinguish();
@@ -199,7 +201,7 @@ namespace Content.Server.GameObjects.Components.Atmos
Owner.SpawnTimer(2000, () => Owner.SpawnTimer(2000, () =>
{ {
_resisting = false; _resisting = false;
FireStacks -= 2f; FireStacks -= 3f;
UpdateAppearance(); UpdateAppearance();
}); });
} }
@@ -224,5 +226,19 @@ namespace Content.Server.GameObjects.Components.Atmos
return ReagentUnit.Zero; return ReagentUnit.Zero;
} }
} }
public async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs)
{
foreach (var hotItem in eventArgs.Using.GetAllComponents<IHotItem>())
{
if (hotItem.IsCurrentlyHot())
{
Ignite();
return true;
}
}
return false;
}
} }
} }

View File

@@ -116,7 +116,8 @@ namespace Content.Shared.GameObjects.Components.Movement
{ {
// Don't collide with other mobs // Don't collide with other mobs
// unless they have combat mode on // unless they have combat mode on
return collidedWith.Entity.HasComponent<IBody>(); /* && return false; //collidedWith.Entity.HasComponent<IBody>();
/* &&
(!Owner.TryGetComponent(out SharedCombatModeComponent? ownerCombat) || !ownerCombat.IsInCombatMode) && (!Owner.TryGetComponent(out SharedCombatModeComponent? ownerCombat) || !ownerCombat.IsInCombatMode) &&
(!collidedWith.Entity.TryGetComponent(out SharedCombatModeComponent? otherCombat) || !otherCombat.IsInCombatMode); (!collidedWith.Entity.TryGetComponent(out SharedCombatModeComponent? otherCombat) || !otherCombat.IsInCombatMode);
*/ */

View File

@@ -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.

View File

@@ -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.

View File

@@ -118,7 +118,7 @@
- type: Physics - type: Physics
bodyType: KinematicController bodyType: KinematicController
mass: 70 mass: 70
fixtures: fixtures: # TODO: This needs a second fixture just for mob collisions.
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.35 radius: 0.35