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; private int? _originalDrawDepth;
[DataField("normal")] [DataField("normal")]
private string? normal; private string? _normal;
[DataField("crit")] [DataField("crit")]
private string? crit; private string? _crit;
[DataField("dead")] [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() void ISerializationHooks.BeforeSerialization()
{ {
_stateMap.TryGetValue(DamageState.Alive, out normal); _stateMap.TryGetValue(DamageState.Alive, out _normal);
_stateMap.TryGetValue(DamageState.Critical, out crit); _stateMap.TryGetValue(DamageState.Critical, out _crit);
_stateMap.TryGetValue(DamageState.Dead, out dead); _stateMap.TryGetValue(DamageState.Dead, out _dead);
} }
void ISerializationHooks.AfterDeserialization() 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; _data = data;
if (_rotate)
{
sprite.NoRotation = data switch
{
DamageState.Critical => false,
DamageState.Dead => false,
_ => true
};
}
if (_stateMap.TryGetValue(_data, out var state)) if (_stateMap.TryGetValue(_data, out var state))
{ {
sprite.LayerSetState(DamageStateVisualLayers.Base, 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;
using Content.Server.AI.WorldState.States.Utility; using Content.Server.AI.WorldState.States.Utility;
using Content.Server.CPUJob.JobQueues; using Content.Server.CPUJob.JobQueues;
using Content.Shared.MobState;
using Content.Shared.Movement.Components; using Content.Shared.Movement.Components;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Log; using Robust.Shared.Log;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
namespace Content.Server.AI.Utility.AiLogic namespace Content.Server.AI.Utility.AiLogic
{ {
@@ -36,7 +36,7 @@ namespace Content.Server.AI.Utility.AiLogic
/// <summary> /// <summary>
/// The sum of all BehaviorSets gives us what actions the AI can take /// The sum of all BehaviorSets gives us what actions the AI can take
/// </summary> /// </summary>
[DataField("behaviorSets")] [DataField("behaviorSets", customTypeSerializer:typeof(PrototypeIdHashSetSerializer<BehaviorSetPrototype>))]
public HashSet<string> BehaviorSets { get; } = new(); public HashSet<string> BehaviorSets { get; } = new();
public List<IAiUtility> AvailableActions { get; set; } = new(); public List<IAiUtility> AvailableActions { get; set; } = new();

View File

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

View File

@@ -15,18 +15,18 @@
- type: Hands - type: Hands
- type: Sprite - type: Sprite
drawdepth: Mobs drawdepth: Mobs
sprite: Mobs/Aliens/Xenos/burrower.rsi
layers: layers:
- map: ["enum.DamageStateVisualLayers.Base"] - map: ["enum.DamageStateVisualLayers.Base"]
state: running state: running
sprite: Mobs/Aliens/Xenos/xeno.rsi
- type: Physics - type: Physics
bodyType: Dynamic bodyType: Dynamic
- type: Fixtures - type: Fixtures
fixtures: fixtures:
- shape: - shape:
!type:PhysShapeAabb !type:PhysShapeCircle
bounds: "-0.4,-1,0.4,-0.2" radius: 0.35
mass: 85 mass: 120
mask: mask:
- Impassable - Impassable
- MobImpassable - MobImpassable
@@ -56,6 +56,7 @@
- type: Appearance - type: Appearance
visuals: visuals:
- type: DamageStateVisualizer - type: DamageStateVisualizer
rotate: true
normal: running normal: running
crit: crit crit: crit
dead: dead 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, "version": 1,
"license": "CC-BY-SA-3.0", "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": { "size": {
"x": 64, "x": 64,
"y": 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