Xeno improvements (#6032)

This commit is contained in:
metalgearsloth
2022-01-06 12:51:53 +11:00
committed by GitHub
parent de0c94414a
commit 4aaa85f84d
13 changed files with 42 additions and 23 deletions

View File

@@ -18,34 +18,42 @@ namespace Content.Client.MobState
private int? _originalDrawDepth;
[DataField("normal")]
private string? normal;
private string? _normal;
[DataField("crit")]
private string? crit;
private string? _crit;
[DataField("dead")]
private string? dead;
private string? _dead;
/// <summary>
/// Should noRot be turned off when crit / dead.
/// </summary>
[DataField("rotate")]
private bool _rotate;
void ISerializationHooks.BeforeSerialization()
{
_stateMap.TryGetValue(DamageState.Alive, out normal);
_stateMap.TryGetValue(DamageState.Critical, out crit);
_stateMap.TryGetValue(DamageState.Dead, out dead);
_stateMap.TryGetValue(DamageState.Alive, out _normal);
_stateMap.TryGetValue(DamageState.Critical, out _crit);
_stateMap.TryGetValue(DamageState.Dead, out _dead);
}
void ISerializationHooks.AfterDeserialization()
{
if (normal != null)
if (_normal != null)
{
_stateMap.Add(DamageState.Alive, normal);
_stateMap.Add(DamageState.Alive, _normal);
}
if (crit != null)
if (_crit != null)
{
_stateMap.Add(DamageState.Critical, crit);
_stateMap.Add(DamageState.Critical, _crit);
}
if (dead != null)
if (_dead != null)
{
_stateMap.Add(DamageState.Dead, dead);
_stateMap.Add(DamageState.Dead, _dead);
}
}
@@ -65,6 +73,16 @@ namespace Content.Client.MobState
_data = data;
if (_rotate)
{
sprite.NoRotation = data switch
{
DamageState.Critical => false,
DamageState.Dead => false,
_ => true
};
}
if (_stateMap.TryGetValue(_data, out var state))
{
sprite.LayerSetState(DamageStateVisualLayers.Base, state);

View File

@@ -10,13 +10,13 @@ using Content.Server.AI.Utility.Actions;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States.Utility;
using Content.Server.CPUJob.JobQueues;
using Content.Shared.MobState;
using Content.Shared.Movement.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
namespace Content.Server.AI.Utility.AiLogic
{
@@ -36,7 +36,7 @@ namespace Content.Server.AI.Utility.AiLogic
/// <summary>
/// The sum of all BehaviorSets gives us what actions the AI can take
/// </summary>
[DataField("behaviorSets")]
[DataField("behaviorSets", customTypeSerializer:typeof(PrototypeIdHashSetSerializer<BehaviorSetPrototype>))]
public HashSet<string> BehaviorSets { get; } = new();
public List<IAiUtility> AvailableActions { get; set; } = new();

View File

@@ -24,12 +24,12 @@
components:
- type: Sprite
layers:
- state: blue
- texture: Mobs/Aliens/Xenos/xeno.rsi/crit.png
- state: ai
- state: blue
- texture: Mobs/Aliens/Xenos/burrower.rsi/crit.png
- state: ai
- type: TimedSpawner
prototypes:
- MobXeno
- MobXeno
chance: 0.85
intervalSeconds: 30
minimumEntitiesSpawned: 2

View File

@@ -15,18 +15,18 @@
- type: Hands
- type: Sprite
drawdepth: Mobs
sprite: Mobs/Aliens/Xenos/burrower.rsi
layers:
- map: ["enum.DamageStateVisualLayers.Base"]
state: running
sprite: Mobs/Aliens/Xenos/xeno.rsi
- type: Physics
bodyType: Dynamic
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.4,-1,0.4,-0.2"
mass: 85
!type:PhysShapeCircle
radius: 0.35
mass: 120
mask:
- Impassable
- MobImpassable
@@ -56,6 +56,7 @@
- type: Appearance
visuals:
- type: DamageStateVisualizer
rotate: true
normal: running
crit: crit
dead: dead

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -1,7 +1,7 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from Colonial Marines at commit https://gitlab.com/cmdevs/colonial-warfare/-/commit/f6b3c61fcbfe73a3f0f92edd5fc441ef845017e5",
"copyright": "Taken from Colonial Marines at commit https://gitlab.com/cmdevs/colonial-warfare/-/commit/f6b3c61fcbfe73a3f0f92edd5fc441ef845017e5 Sprites centered by metalgearsloth",
"size": {
"x": 64,
"y": 64

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB