Skip to content

Commit

Permalink
Добавил эффект коктейлю из крови сумеров + убрал эмоут "задыхается"
Browse files Browse the repository at this point in the history
  • Loading branch information
FaDeOkno committed Sep 9, 2024
1 parent 17bea65 commit 252c57e
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 14 deletions.
31 changes: 31 additions & 0 deletions Content.Server/ADT/EntityEffects/Effects/RandomTeleport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Robust.Shared.Prototypes;
using Content.Shared.StatusEffect;
using Content.Shared.EntityEffects;
using Content.Server.ADT.Shadekin;

namespace Content.Server.Chemistry.ReagentEffects
{
/// <summary>
/// Default metabolism for stimulants and tranqs. Attempts to find a MovementSpeedModifier on the target,
/// adding one if not there and to change the movespeed
/// </summary>
public sealed partial class RandomTeleport : EntityEffect
{
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
{
return Loc.GetString("reagent-effect-guidebook-teleport",
("chance", Probability));
}

public override void Effect(EntityEffectBaseArgs ev)
{
if (ev is not EntityEffectReagentArgs args)
return;

var statusSys = args.EntityManager.EntitySysManager.GetEntitySystem<StatusEffectsSystem>();
var shadekin = args.EntityManager.EntitySysManager.GetEntitySystem<ShadekinSystem>();

shadekin.TeleportRandomly(args.TargetEntity, 2f);
}
}
}
30 changes: 25 additions & 5 deletions Content.Server/ADT/Shadekin/ShadekinSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public override void Update(float frameTime)
if (comp.MinPowerAccumulator >= comp.MinPowerRoof)
BlackEye(uid);
if (comp.MaxedPowerAccumulator >= comp.MaxedPowerRoof)
TeleportRandomly(uid);
TeleportRandomly(uid, comp);
}
}

Expand Down Expand Up @@ -143,12 +143,10 @@ private void OnExamine(EntityUid uid, ShadekinComponent comp, ExaminedEvent args
level = "worst";

if (args.Examiner == uid)
args.PushMarkup(Loc.GetString("shadekin-examine-self-" + level, ("power", comp.PowerLevel)));
else
args.PushMarkup(Loc.GetString("shadekin-examine-others-" + (comp.Blackeye ? "blackeye" : level)));
args.PushMarkup(Loc.GetString("shadekin-examine-self-" + level, ("power", comp.PowerLevel.ToString())));
}

public void TeleportRandomly(EntityUid uid, ShadekinComponent? comp = null)
public void TeleportRandomly(EntityUid uid, ShadekinComponent? comp)
{
if (!Resolve(uid, ref comp))
return;
Expand All @@ -175,6 +173,28 @@ public void TeleportRandomly(EntityUid uid, ShadekinComponent? comp = null)
}
}

public void TeleportRandomly(EntityUid uid, float range = 5f)
{
var coordsValid = false;
EntityCoordinates coords = Transform(uid).Coordinates;

while (!coordsValid)
{
var newCoords = new EntityCoordinates(Transform(uid).ParentUid, coords.X + _random.NextFloat(-range, range), coords.Y + _random.NextFloat(-range, range));
if (_interaction.InRangeUnobstructed(uid, newCoords, -1f))
{
if (TryComp<PullerComponent>(uid, out var puller) && puller.Pulling != null && TryComp<PullableComponent>(puller.Pulling, out var pullable))
_pulling.TryStopPull(puller.Pulling.Value, pullable);
_transform.SetCoordinates(uid, newCoords);
_transform.AttachToGridOrMap(uid, Transform(uid));
_colorFlash.RaiseEffect(Color.DarkCyan, new List<EntityUid>() { uid }, Filter.Pvs(uid, entityManager: EntityManager));
_audio.PlayPvs("/Audio/ADT/Shadekin/shadekin-transition.ogg", uid);
coordsValid = true;
break;
}
}
}

public bool TryUseAbility(EntityUid uid, FixedPoint2 cost, bool allowBlackeye = true, ShadekinComponent? comp = null)
{
if (!Resolve(uid, ref comp))
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Body/Components/RespiratorComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public sealed partial class RespiratorComponent : Component
/// The emote when gasps
/// </summary>
[DataField]
public ProtoId<EmotePrototype> GaspEmote = "Gasp";
public ProtoId<EmotePrototype>? GaspEmote = "Gasp"; // ADT tweak

/// <summary>
/// How many cycles in a row has the mob been under-saturated?
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Body/Systems/RespiratorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public override void Update(float frameTime)

if (respirator.Saturation < respirator.SuffocationThreshold)
{
if (_gameTiming.CurTime >= respirator.LastGaspEmoteTime + respirator.GaspEmoteCooldown)
if (_gameTiming.CurTime >= respirator.LastGaspEmoteTime + respirator.GaspEmoteCooldown && respirator.GaspEmote != null) // ADT tweak
{
respirator.LastGaspEmoteTime = _gameTiming.CurTime;
_chat.TryEmoteWithChat(uid, respirator.GaspEmote, ChatTransmitRange.HideChat, ignoreActionBlocker: true);
Expand Down
5 changes: 5 additions & 0 deletions Resources/Locale/ru-RU/ADT/prototypes/Alerts/alerts.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alerts-charge-name = Заряд
alerts-charge-desc = Количество оставшегося заряда вашей батареи.
alerts-shadekin-power-name = Энергия
alerts-shadekin-power-desc = Количество вашей теневой энергии.
5 changes: 5 additions & 0 deletions Resources/Locale/ru-RU/ADT/shadekin/examine.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
shadekin-examine-self-max = [color=white]Вы переполняетесь энергией! У вас {$power} энергии.[/color]
shadekin-examine-self-good = [color=white]Вы чувствуете себя хорошо. У вас {$power} энергии.[/color]
shadekin-examine-self-okay = [color=white]Вы в порядке. У вас {$power} энергии.[/color]
shadekin-examine-self-bad = [color=white]Вы достаточно сильно устали. У вас {$power} энергии.[/color]
shadekin-examine-self-worst = [color=red]Вы выбились из сил! У вас {$power} энергии.[/color]
15 changes: 8 additions & 7 deletions Resources/Prototypes/ADT/Entities/Mobs/Species/shadekin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@
- MobMask
layer:
- MobLayer
# - type: Respirator # Зачем.
# damage:
# types:
# Asphyxiation: 0.0
# damageRecovery:
# types:
# Asphyxiation: 0.0
- type: Respirator
gaspEmote: null
damage:
types:
Asphyxiation: 0.0
damageRecovery:
types:
Asphyxiation: 0.0
- type: Sprite
scale: 0.95, 0.95
- type: MeleeWeapon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,8 @@
- !type:AdjustReagent
reagent: Ethanol
amount: 0.15
- !type:RandomTeleport
probability: 0.35
conditions:
- !type:ReagentThreshold
min: 20

0 comments on commit 252c57e

Please sign in to comment.