-
Notifications
You must be signed in to change notification settings - Fork 47
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
240 changed files
with
9,252 additions
and
190 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
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
31 changes: 31 additions & 0 deletions
31
Content.Server/ADT/EntityEffects/Effects/RandomTeleport.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,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); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Content.Server/ADT/PlasmaCutter/BatteryRechargeComponent.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,27 @@ | ||
///TAKEN FROM: https://github.com/Workbench-Team/space-station-14/pull/327 | ||
|
||
namespace Content.Server.AruMoon.Plasmacutter; | ||
|
||
[RegisterComponent] | ||
public sealed partial class BatteryRechargeComponent : Component | ||
{ | ||
|
||
/// <summary> | ||
/// NOT (material.Amount * Multiplier) | ||
/// This is (material.materialComposition * Multiplier) | ||
/// 1 plasma sheet = 100 material units | ||
/// 1 plasma ore = 500 material units | ||
/// </summary> | ||
/// | ||
[DataField("multiplier"), ViewVariables(VVAccess.ReadWrite)] | ||
public float Multiplier = 1.0f; | ||
|
||
|
||
/// <summary> | ||
/// Max material storage limit | ||
/// 7500 = 15 plasma ore | ||
/// </summary> | ||
[DataField("storageMaxCapacity"), ViewVariables(VVAccess.ReadWrite)] | ||
public int StorageMaxCapacity = 7500; | ||
} | ||
|
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,74 @@ | ||
///TAKEN FROM: https://github.com/Workbench-Team/space-station-14/pull/327 | ||
|
||
using Content.Server.Materials; | ||
using Content.Shared.Materials; | ||
using Content.Server.Power.EntitySystems; | ||
using Content.Server.Power.Components; | ||
|
||
namespace Content.Server.AruMoon.Plasmacutter | ||
{ | ||
|
||
/// <summary> | ||
/// This CODE FULL OF SHICODE!!! | ||
/// <see cref="BatteryRechargeComponent"/> | ||
/// </summary> | ||
public sealed class BatteryRechargeSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!; | ||
[Dependency] private readonly BatterySystem _batterySystem = default!; | ||
|
||
|
||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<MaterialStorageComponent, MaterialEntityInsertedEvent>(OnMaterialAmountChanged); | ||
SubscribeLocalEvent<BatteryRechargeComponent, ChargeChangedEvent>(OnChargeChanged); | ||
} | ||
|
||
private void OnMaterialAmountChanged(EntityUid uid, MaterialStorageComponent component, MaterialEntityInsertedEvent args) | ||
{ | ||
if (component.MaterialWhiteList != null) | ||
foreach (var fuelType in component.MaterialWhiteList) | ||
{ | ||
FuelAddCharge(uid, fuelType); | ||
} | ||
} | ||
|
||
private void OnChargeChanged(EntityUid uid, BatteryRechargeComponent component, ChargeChangedEvent args) | ||
{ | ||
ChangeStorageLimit(uid, component.StorageMaxCapacity); | ||
} | ||
|
||
private void ChangeStorageLimit( | ||
EntityUid uid, | ||
int value, | ||
BatteryComponent? battery = null) | ||
{ | ||
if (!Resolve(uid, ref battery)) | ||
return; | ||
if (battery.CurrentCharge == battery.MaxCharge) | ||
value = 0; | ||
_materialStorage.TryChangeStorageLimit(uid, value); | ||
} | ||
|
||
private void FuelAddCharge( | ||
EntityUid uid, | ||
string fuelType, | ||
BatteryRechargeComponent? recharge = null) | ||
{ | ||
if (!Resolve(uid, ref recharge)) | ||
return; | ||
|
||
var availableMaterial = _materialStorage.GetMaterialAmount(uid, fuelType); | ||
var chargePerMaterial = availableMaterial * recharge.Multiplier; | ||
|
||
if (_materialStorage.TryChangeMaterialAmount(uid, fuelType, -availableMaterial)) | ||
{ | ||
_batterySystem.TryAddCharge(uid, chargePerMaterial); | ||
} | ||
} | ||
} | ||
|
||
} |
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,229 @@ | ||
using Content.Shared.ADT.Shadekin.Components; | ||
using Robust.Shared.Timing; | ||
using Content.Shared.Damage.Systems; | ||
using Content.Shared.Humanoid; | ||
using Content.Server.Humanoid; | ||
using Content.Shared.ADT.Shadekin; | ||
using System.Numerics; | ||
using Content.Shared.FixedPoint; | ||
using Content.Shared.Interaction; | ||
using Robust.Server.GameObjects; | ||
using Content.Shared.Effects; | ||
using Robust.Shared.Player; | ||
using Robust.Server.Audio; | ||
using Robust.Shared.Map; | ||
using Robust.Shared.Random; | ||
using Content.Shared.Examine; | ||
using Content.Server.Actions; | ||
using Content.Server.Station.Systems; | ||
using Content.Shared.Alert; | ||
using Robust.Shared.Prototypes; | ||
using Content.Shared.Movement.Pulling.Systems; | ||
using Content.Shared.Movement.Pulling.Components; | ||
|
||
namespace Content.Server.ADT.Shadekin; | ||
|
||
public sealed partial class ShadekinSystem : EntitySystem | ||
{ | ||
[Dependency] protected readonly IGameTiming _timing = default!; | ||
[Dependency] private readonly StaminaSystem _stamina = default!; | ||
[Dependency] private readonly SharedInteractionSystem _interaction = default!; | ||
[Dependency] private readonly TransformSystem _transform = default!; | ||
[Dependency] private readonly SharedColorFlashEffectSystem _colorFlash = default!; | ||
[Dependency] private readonly AudioSystem _audio = default!; | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly ActionsSystem _action = default!; | ||
[Dependency] private readonly HumanoidAppearanceSystem _humanoid = default!; | ||
[Dependency] private readonly AlertsSystem _alert = default!; | ||
[Dependency] private readonly IPrototypeManager _proto = default!; | ||
[Dependency] private readonly PullingSystem _pulling = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<ShadekinComponent, ShadekinTeleportActionEvent>(OnTeleport); | ||
SubscribeLocalEvent<ShadekinComponent, ExaminedEvent>(OnExamine); | ||
SubscribeLocalEvent<ShadekinComponent, ComponentInit>(OnInit); | ||
SubscribeLocalEvent<ShadekinComponent, ComponentShutdown>(OnShutdown); | ||
|
||
SubscribeLocalEvent<ShadekinComponent, MapInitEvent>(OnMapInit); | ||
} | ||
|
||
public override void Update(float frameTime) | ||
{ | ||
base.Update(frameTime); | ||
|
||
var query = EntityQueryEnumerator<ShadekinComponent>(); | ||
while (query.MoveNext(out var uid, out var comp)) | ||
{ | ||
if (comp.NextSecond > _timing.CurTime) | ||
continue; | ||
if (comp.Blackeye) | ||
continue; | ||
_alert.ShowAlert(uid, _proto.Index<AlertPrototype>("ShadekinPower"), (short) Math.Clamp(Math.Round(comp.PowerLevel / 50f), 0, 4)); | ||
comp.NextSecond = _timing.CurTime + TimeSpan.FromSeconds(1); | ||
|
||
if (comp.PowerLevel >= comp.PowerLevelMax) | ||
comp.MaxedPowerAccumulator += 1f; | ||
else | ||
{ | ||
comp.PowerLevel += comp.PowerLevelGain * comp.PowerLevelGainMultiplier; | ||
comp.MaxedPowerAccumulator = 0f; | ||
} | ||
|
||
if (comp.PowerLevel < comp.PowerLevelMin) | ||
comp.MinPowerAccumulator += 1f; | ||
else | ||
comp.MinPowerAccumulator = 0f; | ||
|
||
if (comp.MinPowerAccumulator >= comp.MinPowerRoof) | ||
BlackEye(uid); | ||
if (comp.MaxedPowerAccumulator >= comp.MaxedPowerRoof) | ||
TeleportRandomly(uid, comp); | ||
} | ||
} | ||
|
||
private void OnInit(EntityUid uid, ShadekinComponent comp, ComponentInit args) | ||
{ | ||
_alert.ShowAlert(uid, _proto.Index<AlertPrototype>("ShadekinPower"), (short) Math.Clamp(Math.Round(comp.PowerLevel / 50f), 0, 4)); | ||
} | ||
|
||
private void OnShutdown(EntityUid uid, ShadekinComponent comp, ComponentShutdown args) | ||
{ | ||
_alert.ClearAlert(uid, _proto.Index<AlertPrototype>("ShadekinPower")); | ||
if (comp.ActionEntity != null) | ||
_action.RemoveAction(uid, comp.ActionEntity); | ||
} | ||
|
||
private void OnMapInit(EntityUid uid, ShadekinComponent comp, MapInitEvent args) | ||
{ | ||
// if ( // Оно очень странно получается, работает только при позднем подключении | ||
// args.Profile.Appearance.EyeColor.B < 100f && | ||
// args.Profile.Appearance.EyeColor.R < 100f && | ||
// args.Profile.Appearance.EyeColor.G < 100f) | ||
// { | ||
// comp.Blackeye = true; | ||
// comp.PowerLevelGainEnabled = false; | ||
// comp.PowerLevel = 0f; | ||
// return; | ||
// } | ||
_alert.ShowAlert(uid, _proto.Index<AlertPrototype>("ShadekinPower"), (short) Math.Clamp(Math.Round(comp.PowerLevel / 50f), 0, 4)); | ||
_action.AddAction(uid, ref comp.ActionEntity, comp.ActionProto); | ||
} | ||
|
||
private void OnTeleport(EntityUid uid, ShadekinComponent comp, ShadekinTeleportActionEvent args) | ||
{ | ||
if (args.Handled) | ||
return; | ||
// if (_interaction.InRangeUnobstructed(uid, args.Target, -1f)) | ||
// return; | ||
if (!TryUseAbility(uid, 50)) | ||
return; | ||
args.Handled = true; | ||
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, args.Target); | ||
_colorFlash.RaiseEffect(Color.DarkCyan, new List<EntityUid>() { uid }, Filter.Pvs(uid, entityManager: EntityManager)); | ||
_audio.PlayPvs("/Audio/ADT/Shadekin/shadekin-transition.ogg", uid); | ||
} | ||
|
||
private void OnExamine(EntityUid uid, ShadekinComponent comp, ExaminedEvent args) | ||
{ | ||
var level = "max"; | ||
if (comp.PowerLevel == 250f) | ||
level = "max"; | ||
if (comp.PowerLevel < 250f) | ||
level = "good"; | ||
if (comp.PowerLevel <= 200f) | ||
level = "okay"; | ||
if (comp.PowerLevel <= 100f) | ||
level = "bad"; | ||
if (comp.PowerLevel <= 50f) | ||
level = "worst"; | ||
|
||
if (args.Examiner == uid) | ||
args.PushMarkup(Loc.GetString("shadekin-examine-self-" + level, ("power", comp.PowerLevel.ToString()))); | ||
} | ||
|
||
public void TeleportRandomly(EntityUid uid, ShadekinComponent? comp) | ||
{ | ||
if (!Resolve(uid, ref comp)) | ||
return; | ||
var coordsValid = false; | ||
EntityCoordinates coords = Transform(uid).Coordinates; | ||
|
||
while (!coordsValid) | ||
{ | ||
var newCoords = new EntityCoordinates(Transform(uid).ParentUid, coords.X + _random.NextFloat(-5f, 5f), coords.Y + _random.NextFloat(-5f, 5f)); | ||
if (_interaction.InRangeUnobstructed(uid, newCoords, -1f)) | ||
{ | ||
TryUseAbility(uid, 40, false); | ||
if (TryComp<PullerComponent>(uid, out var puller) && puller.Pulling != null && TryComp<PullableComponent>(puller.Pulling, out var pullable)) | ||
_pulling.TryStopPull(puller.Pulling.Value, pullable); | ||
_alert.ShowAlert(uid, _proto.Index<AlertPrototype>("ShadekinPower"), (short) Math.Clamp(Math.Round(comp.PowerLevel / 50f), 0, 4)); | ||
_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); | ||
comp.MaxedPowerAccumulator = 0f; | ||
coordsValid = true; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
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)) | ||
return false; | ||
if (comp.PowerLevel <= cost && allowBlackeye) | ||
{ | ||
BlackEye(uid); | ||
return false; | ||
} | ||
comp.PowerLevel -= cost.Float(); | ||
_alert.ShowAlert(uid, _proto.Index<AlertPrototype>("ShadekinPower"), (short) Math.Clamp(Math.Round(comp.PowerLevel / 50f), 0, 4)); | ||
return true; | ||
} | ||
|
||
public void BlackEye(EntityUid uid, ShadekinComponent? comp = null) | ||
{ | ||
if (!Resolve(uid, ref comp)) | ||
return; | ||
|
||
comp.Blackeye = true; | ||
comp.PowerLevelGainEnabled = false; | ||
comp.PowerLevel = 0f; | ||
_stamina.TakeStaminaDamage(uid, 150f); | ||
if (TryComp<HumanoidAppearanceComponent>(uid, out var humanoid)) | ||
{ | ||
humanoid.EyeColor = Color.Black; | ||
Dirty(uid, humanoid); | ||
} | ||
_alert.ShowAlert(uid, _proto.Index<AlertPrototype>("ShadekinPower"), (short) Math.Clamp(Math.Round(comp.PowerLevel / 50f), 0, 5)); | ||
_action.RemoveAction(comp.ActionEntity); | ||
} | ||
} |
Oops, something went wrong.