Improves FlammableComponent, allow mobs to collide with each other.
This commit is contained in:
@@ -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<EntityUid> _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<bool> InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
foreach (var hotItem in eventArgs.Using.GetAllComponents<IHotItem>())
|
||||
{
|
||||
if (hotItem.IsCurrentlyHot())
|
||||
{
|
||||
Ignite();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<IBody>(); /* &&
|
||||
(!Owner.TryGetComponent(out SharedCombatModeComponent? ownerCombat) || !ownerCombat.IsInCombatMode) &&
|
||||
(!collidedWith.Entity.TryGetComponent(out SharedCombatModeComponent? otherCombat) || !otherCombat.IsInCombatMode);
|
||||
*/
|
||||
return false; //collidedWith.Entity.HasComponent<IBody>();
|
||||
/* &&
|
||||
(!Owner.TryGetComponent(out SharedCombatModeComponent? ownerCombat) || !ownerCombat.IsInCombatMode) &&
|
||||
(!collidedWith.Entity.TryGetComponent(out SharedCombatModeComponent? otherCombat) || !otherCombat.IsInCombatMode);
|
||||
*/
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
4
Resources/Changelog/Parts/fire_passing.yml
Normal file
4
Resources/Changelog/Parts/fire_passing.yml
Normal 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.
|
||||
4
Resources/Changelog/Parts/flammable.yml
Normal file
4
Resources/Changelog/Parts/flammable.yml
Normal 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.
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user