-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
1,016 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using Content.Client.DamageState; | ||
using Content.Client.Humanoid; | ||
using Content.Shared.ADT.Salvage; | ||
using Content.Shared.ADT.Salvage.Components; | ||
using Content.Shared.Mobs.Components; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Player; | ||
using Robust.Client.UserInterface; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Random; | ||
|
||
namespace Content.Client.ADT.Salvage; | ||
|
||
public sealed class MegafaunaVisualsSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!; | ||
[Dependency] private readonly IPrototypeManager _proto = default!; | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; | ||
[Dependency] private readonly IPlayerManager _playerMan = default!; | ||
[Dependency] private readonly SpriteSystem _spriteSystem = default!; | ||
[Dependency] private readonly HumanoidAppearanceSystem _appearanceSystem = default!; | ||
[Dependency] private readonly IEntityManager _entManager = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<MegafaunaComponent, AppearanceChangeEvent>(OnAppearanceChange); | ||
} | ||
|
||
private void OnAppearanceChange(EntityUid uid, MegafaunaComponent comp, ref AppearanceChangeEvent args) | ||
{ | ||
if (!TryComp<SpriteComponent>(uid, out var sprite)) | ||
return; | ||
if (!TryComp<DamageStateVisualsComponent>(uid, out var state)) | ||
return; | ||
if (!TryComp<MobStateComponent>(uid, out var mob)) | ||
return; | ||
if (!state.States.TryGetValue(mob.CurrentState, out var layers)) | ||
return; | ||
|
||
if (_appearance.TryGetData<bool>(uid, AshdrakeVisuals.Swoop, out var swoop)) | ||
{ | ||
if (!sprite.LayerMapTryGet("drake_swoop", out var index)) | ||
index = sprite.LayerMapReserveBlank("drake_swoop"); | ||
sprite.LayerSetState(index, "swoop"); | ||
sprite.LayerSetVisible(index, swoop); | ||
|
||
foreach (var (key, _) in layers) | ||
{ | ||
if (!sprite.LayerMapTryGet(key, out var layer)) continue; | ||
sprite.LayerSetVisible(layer, !swoop); | ||
} | ||
} | ||
} | ||
} |
112 changes: 112 additions & 0 deletions
112
Content.Server/ADT/Salvage/Systems/Megafauna/MegafaunaSystem.Drake.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
using System.Numerics; | ||
using Content.Server.Actions; | ||
using Content.Server.ADT.Language; | ||
using Content.Server.ADT.Salvage.Components; | ||
using Content.Server.Body.Components; | ||
using Content.Server.Body.Systems; | ||
using Content.Server.Interaction; | ||
using Content.Server.Polymorph.Systems; | ||
using Content.Server.Popups; | ||
using Content.Server.Stunnable; | ||
using Content.Server.Weapons.Ranged.Systems; | ||
using Content.Shared.Access.Systems; | ||
using Content.Shared.ADT.Language; | ||
using Content.Shared.ADT.Salvage; | ||
using Content.Shared.ADT.Salvage.Components; | ||
using Content.Shared.Chasm; | ||
using Content.Shared.Damage; | ||
using Content.Shared.Damage.Prototypes; | ||
using Content.Shared.Interaction.Events; | ||
using Content.Shared.Inventory; | ||
using Content.Shared.Lathe; | ||
using Content.Shared.Mobs.Systems; | ||
using Content.Shared.Popups; | ||
using Content.Shared.Weapons.Ranged.Components; | ||
using Robust.Server.Audio; | ||
using Robust.Server.GameObjects; | ||
using Robust.Shared.Audio; | ||
using Robust.Shared.Audio.Systems; | ||
using Robust.Shared.Containers; | ||
using Robust.Shared.Map; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Random; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Server.ADT.Salvage.Systems; | ||
|
||
public sealed partial class MegafaunaSystem | ||
{ | ||
[Dependency] private readonly PopupSystem _popup = default!; | ||
[Dependency] private readonly IPrototypeManager _proto = default!; | ||
[Dependency] private readonly StunSystem _stun = default!; | ||
[Dependency] private readonly AppearanceSystem _appearance = default!; | ||
[Dependency] private readonly PolymorphSystem _polymorph = default!; | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly GunSystem _gun = default!; | ||
[Dependency] private readonly TransformSystem _transform = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<AshDrakeSwoopActionEvent>(OnSwoop); | ||
SubscribeLocalEvent<AshDrakeMeteoritesActionEvent>(OnMeteors); | ||
SubscribeLocalEvent<AshDrakeFireActionEvent>(OnFire); | ||
SubscribeLocalEvent<AshDrakeBreathActionEvent>(OnBreath); | ||
} | ||
|
||
private void OnSwoop(AshDrakeSwoopActionEvent args) | ||
{ | ||
var uid = args.Performer; | ||
|
||
_appearance.SetData(uid, AshdrakeVisuals.Swoop, true); | ||
|
||
_stun.TryStun(uid, TimeSpan.FromSeconds(0.5f), false); | ||
Timer.Spawn(TimeSpan.FromSeconds(0.5f), () => Swoop(uid)); | ||
} | ||
|
||
private void OnMeteors(AshDrakeMeteoritesActionEvent args) | ||
{ | ||
var uid = args.Performer; | ||
|
||
var randVector = _random.NextVector2(6); | ||
|
||
var pseudoGun = Spawn("WeaponDragonMeteorites", Transform(uid).Coordinates); | ||
_gun.AttemptShoot(uid, pseudoGun, Comp<GunComponent>(pseudoGun), new(Transform(uid).ParentUid, randVector.X, randVector.Y)); | ||
QueueDel(pseudoGun); | ||
_stun.TryStun(uid, TimeSpan.FromSeconds(0.5f), false); | ||
} | ||
|
||
private void OnFire(AshDrakeFireActionEvent args) | ||
{ | ||
var uid = args.Performer; | ||
if (!args.Coords.HasValue) | ||
return; | ||
|
||
var coords = args.Coords.Value; | ||
|
||
var pseudoGun = Spawn("WeaponDragonFire", Transform(uid).Coordinates); | ||
_gun.AttemptShoot(uid, pseudoGun, Comp<GunComponent>(pseudoGun), coords); | ||
QueueDel(pseudoGun); | ||
_stun.TryStun(uid, TimeSpan.FromSeconds(0.5f), false); | ||
} | ||
|
||
private void OnBreath(AshDrakeBreathActionEvent args) | ||
{ | ||
var uid = args.Performer; | ||
if (!args.Coords.HasValue) | ||
return; | ||
|
||
var coords = args.Coords.Value; | ||
|
||
var pseudoGun = Spawn("WeaponDragonBreath", Transform(uid).Coordinates); | ||
_gun.AttemptShoot(uid, pseudoGun, Comp<GunComponent>(pseudoGun), coords); | ||
QueueDel(pseudoGun); | ||
_stun.TryStun(uid, TimeSpan.FromSeconds(0.5f), false); | ||
} | ||
|
||
private void Swoop(EntityUid uid) | ||
{ | ||
_appearance.SetData(uid, AshdrakeVisuals.Swoop, false); | ||
_polymorph.PolymorphEntity(uid, "SwoopDrake"); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
Content.Server/ADT/Salvage/Systems/Megafauna/MegafaunaSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace Content.Server.ADT.Salvage.Systems; | ||
|
||
public sealed partial class MegafaunaSystem : EntitySystem | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
Content.Shared/ADT/Salvage/Components/MegafaunaComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.ADT.Salvage.Components; | ||
|
||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class MegafaunaComponent : Component | ||
{ | ||
[DataField] | ||
public bool Hardmode = false; | ||
} |
Oops, something went wrong.