Merge branch 'master' into prediction

This commit is contained in:
Pieter-Jan Briers
2020-04-18 14:07:02 +02:00
237 changed files with 4278 additions and 1948 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.Mobs;
using Content.Server.GameObjects.Components.Observer;
using Content.Server.Mobs;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.ViewVariables;
@@ -46,13 +47,31 @@ namespace Content.Server.GameObjects.Components.Mobs
Mind = value;
}
public override void OnRemove()
protected override void Shutdown()
{
base.OnRemove();
base.Shutdown();
if (HasMind)
{
Mind.TransferTo(null);
var visiting = Mind.VisitingEntity;
if (visiting != null)
{
if (visiting.TryGetComponent(out GhostComponent ghost))
{
ghost.CanReturnToBody = false;
}
Mind.TransferTo(visiting);
}
else
{
var ghost = Owner.EntityManager.SpawnEntity("MobObserver", Owner.Transform.GridPosition);
ghost.Name = Mind.CharacterName;
var ghostComponent = ghost.GetComponent<GhostComponent>();
ghostComponent.CanReturnToBody = false;
Mind.TransferTo(ghost);
}
}
}
}

View File

@@ -3,9 +3,12 @@ using System.Collections.Generic;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Movement;
using Content.Server.Observer;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Mobs;
using Robust.Server.GameObjects;
using Robust.Server.Interfaces.Player;
using Robust.Shared.ContentPack;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
@@ -15,7 +18,7 @@ using Robust.Shared.Serialization;
namespace Content.Server.GameObjects
{
[RegisterComponent]
public class SpeciesComponent : SharedSpeciesComponent, IActionBlocker, IOnDamageBehavior, IExAct
public class SpeciesComponent : SharedSpeciesComponent, IActionBlocker, IOnDamageBehavior, IExAct, IRelayMoveInput
{
/// <summary>
/// Damagestates are reached by reaching a certain damage threshold, they will block actions after being reached
@@ -198,6 +201,14 @@ namespace Content.Server.GameObjects
Owner.GetComponent<DamageableComponent>().TakeDamage(DamageType.Brute, bruteDamage, null);
Owner.GetComponent<DamageableComponent>().TakeDamage(DamageType.Heat, burnDamage, null);
}
void IRelayMoveInput.MoveInputPressed(IPlayerSession session)
{
if (CurrentDamageState is DeadState)
{
new Ghost().Execute(null, session, null);
}
}
}
/// <summary>