Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UPDATE Xeno and litle FIX] #912

Merged
merged 30 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
838281b
[X]
NameLunar Dec 26, 2024
ac1079b
[X1]
NameLunar Dec 26, 2024
2a2f021
[1]
NameLunar Dec 26, 2024
1d7c1b3
[2]
NameLunar Dec 27, 2024
0ca4753
[✔]
NameLunar Jan 3, 2025
1cb05c7
[Update]
NameLunar Jan 4, 2025
ad1e7f5
[Fix]
NameLunar Jan 4, 2025
63b56a4
Merge branch 'master' into Draft
Schrodinger71 Jan 4, 2025
57cb903
Merge branch 'master' into Draft
NameLunar Jan 4, 2025
e4b4280
Merge branch 'master' into Draft
NameLunar Jan 5, 2025
d8c1d2c
Merge branch 'master' into Draft
NameLunar Jan 5, 2025
a649e96
Merge branch 'master' into Draft
Schrodinger71 Jan 6, 2025
62b9aeb
Merge branch 'master' into Draft
NameLunar Jan 7, 2025
4d41fa5
[T] Уменьшение макс очков + кастыль для турельки
NameLunar Jan 7, 2025
25d837f
Merge branch 'Draft' of https://github.com/NameLunar/space_station_AD…
NameLunar Jan 7, 2025
bbf356d
[T] Создание ошибки?
NameLunar Jan 7, 2025
0970799
[Update]
NameLunar Jan 7, 2025
11cf47f
Poison, а не Posion
NameLunar Jan 7, 2025
3b6d165
[F]
NameLunar Jan 7, 2025
53117a4
[Fix]
NameLunar Jan 7, 2025
bc4969a
[Upd]
NameLunar Jan 7, 2025
8b053d2
Ops
NameLunar Jan 7, 2025
5960127
Добавли DataDefinition
NameLunar Jan 7, 2025
2186ecb
Merge branch 'master' into Draft
NameLunar Jan 8, 2025
515219a
Merge branch 'master' into Draft
NameLunar Jan 8, 2025
09a5acb
Merge branch 'master' into Draft
NameLunar Jan 9, 2025
ba48399
[Fix] SpawnWallActionEvent -> EmptyXenoActionEvent and Remove Sec_shu…
NameLunar Jan 9, 2025
eaf0254
[Add Fauna]
NameLunar Jan 9, 2025
5f5ec47
[Add PowerCellMicroreactor for BorgChassisSyndicateAssault]
NameLunar Jan 9, 2025
43c9677
Проблы, табы и тд
NameLunar Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 0 additions & 66 deletions Content.Server/ADT/Abilities/XenoQeen/XenoQeenSystem.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Abilities.XenoQeen
namespace Content.Server.Abilities.XenoQueen
{
/// <summary>
/// Lets its owner entity use mime powers, like placing invisible walls.
/// </summary>
[RegisterComponent]
public sealed partial class XenoQeenComponent : Component
public sealed partial class XenoQueenComponent : Component
{
/// <summary>
/// Whether this component is active or not.
Expand All @@ -25,5 +25,27 @@ public sealed partial class XenoQeenComponent : Component
public string? XenoTurretAction = "ActionXenoQeenTurret";
NameLunar marked this conversation as resolved.
Show resolved Hide resolved

[DataField("xenoTurretActionEntity")] public EntityUid? XenoTurretActionEntity;

// Призывы
[DataField]
public EntityUid? ActionSpawnXenoBurrower;

[DataField]
public EntityUid? ActionSpawnXenoDrone;

[DataField]
public EntityUid? ActionSpawnXenoRunner;

[DataField]
public EntityUid? ActionSpawnXenoSpitter;

[DataField]
public EntityUid? ActionSpawnXenoPraetorian;

[DataField]
public EntityUid? ActionSpawnXenoRavager;

[DataField]
public EntityUid? ActionSpawnXenoQueen;
}
}
143 changes: 143 additions & 0 deletions Content.Server/ADT/Abilities/XenoQueen/XenoQueenSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
using Content.Server.Popups;
using Content.Shared.Actions;
using Content.Shared.Actions.Events;
using Content.Shared.Maps;
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Magic.Events;
using Content.Shared.Physics;
using Robust.Shared.Containers;
using Robust.Shared.Spawners;
using Robust.Shared.Map;
using Robust.Shared.Random;
using System.Numerics;
using Content.Shared.Storage;
using Robust.Shared.Network;
using Content.Shared.Magic;

namespace Content.Server.Abilities.XenoQueen
{
public sealed class XenoQueenSystem : EntitySystem
{
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly TurfSystem _turf = default!;
[Dependency] private readonly INetManager _net = default!;
[Dependency] private readonly IMapManager _mapMan = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<XenoQueenComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<XenoQueenComponent, InvisibleWallActionEvent>(OnCreateTurret);
SubscribeLocalEvent<SpawnXenoQueenEvent> (OnWorldSpawn);
}

public override void Update(float frameTime)
{
base.Update(frameTime);
}
private void OnComponentInit(EntityUid uid, XenoQueenComponent component, ComponentInit args)
NameLunar marked this conversation as resolved.
Show resolved Hide resolved
{
_actionsSystem.AddAction(uid, ref component.XenoTurretActionEntity, component.XenoTurretAction, uid);
_actionsSystem.AddAction(uid, ref component.ActionSpawnXenoBurrower, "ActionSpawnMobXenoBurrower");
_actionsSystem.AddAction(uid, ref component.ActionSpawnXenoDrone, "ActionSpawnMobXenoDrone");
_actionsSystem.AddAction(uid, ref component.ActionSpawnXenoRunner, "ActionSpawnMobXenoRunner");
_actionsSystem.AddAction(uid, ref component.ActionSpawnXenoSpitter, "ActionSpawnMobXenoSpitter");
_actionsSystem.AddAction(uid, ref component.ActionSpawnXenoPraetorian, "ActionSpawnMobXenoPraetorian");
_actionsSystem.AddAction(uid, ref component.ActionSpawnXenoRavager, "ActionSpawnMobXenoRavager");
//_actionsSystem.AddAction(uid, ref component.ActionSpawnXenoQueen, "ActionSpawnMobXenoQueen");
}
private void OnCreateTurret(EntityUid uid, XenoQueenComponent component, InvisibleWallActionEvent args)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну какой InvisibleWallActionEvent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ме.. Не хочу создавать новый пустой ивент..

{
if (!component.Enabled)
return;

if (_container.IsEntityOrParentInContainer(uid))
return;

var xform = Transform(uid);
// Get the tile in front of the Qeen
var offsetValue = xform.LocalRotation.ToWorldVec();
var coords = xform.Coordinates.Offset(offsetValue).SnapToGrid(EntityManager, _mapMan);
var tile = coords.GetTileRef(EntityManager, _mapMan);
if (tile == null)
return;

// Check if the tile is blocked by a wall or mob, and don't create the wall if so
if (_turf.IsTileBlocked(tile.Value, CollisionGroup.Impassable | CollisionGroup.Opaque))
{
_popupSystem.PopupEntity(Loc.GetString("create-turret-failed"), uid, uid);
return;
}

_popupSystem.PopupEntity(Loc.GetString("create-turret"), uid);
// Make sure we set the invisible wall to despawn properly
Spawn(component.XenoTurret, _turf.GetTileCenter(tile.Value));
// Handle args so cooldown works
args.Handled = true;
}
// Spawn Tipo
private void OnWorldSpawn(SpawnXenoQueenEvent args)
NameLunar marked this conversation as resolved.
Show resolved Hide resolved
{
if (args.Handled || !PassesSpellPrerequisites(args.Action, args.Performer))
return;

var targetMapCoords = args.Target;

WorldSpawnSpellHelper(args.Prototypes, targetMapCoords, args.Performer, args.Lifetime, args.Offset);
Speak(args);
args.Handled = true;
}
// Help
private void WorldSpawnSpellHelper(List<EntitySpawnEntry> entityEntries, EntityCoordinates entityCoords, EntityUid performer, float? lifetime, Vector2 offsetVector2)
NameLunar marked this conversation as resolved.
Show resolved Hide resolved
{
var getProtos = EntitySpawnCollection.GetSpawns(entityEntries, _random);

var offsetCoords = entityCoords;
foreach (var proto in getProtos)
{
SpawnSpellHelper(proto, offsetCoords, performer, lifetime);
offsetCoords = offsetCoords.Offset(offsetVector2);
}
}
// Help 2
private void SpawnSpellHelper(string? proto, EntityCoordinates position, EntityUid performer, float? lifetime = null, bool preventCollide = false)
{
if (!_net.IsServer)
return;

var ent = Spawn(proto, position.SnapToGrid(EntityManager, _mapManager));

if (lifetime != null)
{
var comp = EnsureComp<TimedDespawnComponent>(ent);
comp.Lifetime = lifetime.Value;
}

if (preventCollide)
{
var comp = EnsureComp<PreventCollideComponent>(ent);
comp.Uid = performer;
}
}
//
private bool PassesSpellPrerequisites(EntityUid spell, EntityUid performer)
{
var ev = new BeforeCastSpellEvent(performer);
RaiseLocalEvent(spell, ref ev);
return !ev.Cancelled;
}
//
private void Speak(BaseActionEvent args)
{
if (args is not ISpeakSpell speak || string.IsNullOrWhiteSpace(speak.Speech))
return;

var ev = new SpeakSpellEvent(args.Performer, speak.Speech);
RaiseLocalEvent(ref ev);
}
}
}
37 changes: 37 additions & 0 deletions Content.Server/ADT/Events/SpawnXenoQueenEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.Numerics;
using Content.Shared.Actions;
using Content.Shared.Storage;

namespace Content.Shared.Magic.Events;

// TODO: This class needs combining with InstantSpawnSpellEvent

public sealed partial class SpawnXenoQueenEvent : WorldTargetActionEvent, ISpeakSpell
{
/// <summary>
/// The list of prototypes this spell will spawn
/// </summary>
[DataField]
public List<EntitySpawnEntry> Prototypes = new();

// TODO: This offset is liable for deprecation.
// TODO: Target tile via code instead?
/// <summary>
/// The offset the prototypes will spawn in on relative to the one prior.
/// Set to 0,0 to have them spawn on the same tile.
/// </summary>
[DataField]
public Vector2 Offset;

/// <summary>
/// Lifetime to set for the entities to self delete
/// </summary>
[DataField]
public float? Lifetime;

[DataField]
public string? Speech { get; private set; }

[DataField]
public int? Cost { get; private set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ ent-ActionSpawnMobXenoPraetorian = Призвать Преторианеца
ent-ActionSpawnMobXenoDrone = Просто Дрон. Кому он нужен?
.desc = Родите рабочего, Дрон.
ent-ActionSpawnMobXenoRavager = Призвать Разрушителя
.desc = Родите смерть во плоти!
.desc = Родите [color=red]смерть[/color] во плоти!
ent-ActionSpawnMobXenoRunner = Призвать Бегуна
.desc = Родите самую быструю личинку!
ent-ActionSpawnMobXenoBurrower = Призвать рабочего
.desc = Стандартный ксено.
.desc = Стандартный ксено.
ent-ActionSpawnMobXenoQueen = Призвать [color=violet]Королеву[/color].
KashRas2 marked this conversation as resolved.
Show resolved Hide resolved
.desc = [color=red]Новое потомство! Новое поколенеи! Эволюция![/color]
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@
event: !type:InvisibleWallActionEvent
# Я не смог сделать отдельный ивент для спавнта турели. Он не видел прототип ивента.

- type: entity
id: ActionSpawnMobXenoQueen
name: Spawn Queen
description: New offspring!
categories: [ HideSpawnMenu ]
components:
- type: WorldTargetAction
useDelay: 1200
range: 4
itemIconStyle: BigAction
icon:
sprite: Mobs/Aliens/Xenos/queen.rsi
state: crit
event: !type:WorldSpawnSpellEvent
prototypes:
- id: MobXenoQueen
amount: 1
offset: 0, 1
speech: "Ааааааа! Ррррр!"

- type: entity
id: ActionSpawnMobXenoBurrower
name: Spawn Burrower
Expand All @@ -26,12 +46,13 @@
icon:
sprite: Mobs/Aliens/Xenos/burrower.rsi
state: crit
event: !type:WorldSpawnSpellEvent
event: !type:SpawnXenoQueenEvent
prototypes:
- id: MobXeno
amount: 1
offset: 0, 1
speech: "Фаьюп"
cost: 10

- type: entity
id: ActionSpawnMobXenoSpitter
Expand Down
Loading
Loading