Sprite refactor (#63)
* Sprite refactor compatibility. * Sprite-level rotation. * Dude it works. Welder now has an unshaded flame toggle! Door component no longer on client! * Remove debug text. * Update.
This commit is contained in:
committed by
clusterfack
parent
2ba705ffe9
commit
61a1e769d7
@@ -3,6 +3,7 @@ using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Shared.GameObjects;
|
||||
using SS14.Server.GameObjects;
|
||||
using SS14.Shared.GameObjects;
|
||||
using SS14.Shared.GameObjects.Serialization;
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
using SS14.Shared.Interfaces.GameObjects.Components;
|
||||
using SS14.Shared.Log;
|
||||
@@ -12,13 +13,26 @@ using Content.Server.GameObjects.EntitySystems;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
{
|
||||
public class ServerDoorComponent : SharedDoorComponent, IAttackHand
|
||||
public class ServerDoorComponent : Component, IAttackHand
|
||||
{
|
||||
public override string Name => "Door";
|
||||
public bool Opened { get; private set; }
|
||||
|
||||
private float OpenTimeCounter;
|
||||
|
||||
|
||||
private CollidableComponent collidableComponent;
|
||||
private SpriteComponent spriteComponent;
|
||||
|
||||
private string OpenSprite;
|
||||
private string CloseSprite;
|
||||
|
||||
public override void ExposeData(EntitySerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref OpenSprite, "openstate", "Objects/door_ewo.png");
|
||||
serializer.DataField(ref CloseSprite, "closestate", "Objects/door_ew.png");
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -26,12 +40,14 @@ namespace Content.Server.GameObjects
|
||||
|
||||
collidableComponent = Owner.GetComponent<CollidableComponent>();
|
||||
collidableComponent.OnBump += OnBump;
|
||||
spriteComponent = Owner.GetComponent<SpriteComponent>();
|
||||
}
|
||||
|
||||
public override void OnRemove()
|
||||
{
|
||||
collidableComponent.OnBump -= OnBump;
|
||||
collidableComponent = null;
|
||||
spriteComponent = null;
|
||||
}
|
||||
|
||||
public bool Attackhand(IEntity user)
|
||||
@@ -62,6 +78,7 @@ namespace Content.Server.GameObjects
|
||||
{
|
||||
Opened = true;
|
||||
collidableComponent.IsHardCollidable = false;
|
||||
spriteComponent.LayerSetTexture(0, OpenSprite);
|
||||
}
|
||||
|
||||
public bool Close()
|
||||
@@ -74,14 +91,10 @@ namespace Content.Server.GameObjects
|
||||
Opened = false;
|
||||
OpenTimeCounter = 0;
|
||||
collidableComponent.IsHardCollidable = true;
|
||||
spriteComponent.LayerSetTexture(0, CloseSprite);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new DoorComponentState(Opened);
|
||||
}
|
||||
|
||||
private const float AUTO_CLOSE_DELAY = 5;
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user