Skip to content

Commit

Permalink
Merge branch 'master' into upstream180224
Browse files Browse the repository at this point in the history
  • Loading branch information
PyotrIgn authored Feb 26, 2024
2 parents 55e15fb + ce35e26 commit f04df39
Show file tree
Hide file tree
Showing 539 changed files with 1,632,169 additions and 65,390 deletions.
12 changes: 12 additions & 0 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ public sealed class PostMapInitTest
"ADTNYMarathon",
"ADTNYBagel",
"ADTNYDelta",
"ADTFland",
"ADTMeta",
"ADTCluster",
"ADTOmega",
"ADTBagel",
"ADTOrigin",
"ADTBox",
"ADTEuropa",
"ADTSaltern",
"ADTCore",
"ADTMarathon",
"ADTAtlas",

// Corvax-Start
"CorvaxAvrite",
Expand Down
14 changes: 14 additions & 0 deletions Content.Server/ADT/SizeAttribute/SizeAttributeComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Content.Shared.ADT.Cloning;

namespace Content.Server.SizeAttribute
{
[RegisterComponent]
public sealed partial class SizeAttributeComponent : Component, ITransferredByCloning
{
[DataField("short")]
public bool Short = false;

[DataField("tall")]
public bool Tall = false;
}
}
94 changes: 94 additions & 0 deletions Content.Server/ADT/SizeAttribute/SizeAttributeSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using System.Numerics;
using Robust.Server.GameObjects;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Physics.Systems;
using Content.Shared.Item.PseudoItem;

namespace Content.Server.SizeAttribute
{
public sealed class SizeAttributeSystem : EntitySystem
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly FixtureSystem _fixtures = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SizeAttributeComponent, ComponentInit>(OnComponentInit);
}

private void OnComponentInit(EntityUid uid, SizeAttributeComponent component, ComponentInit args)
{
if (!TryComp<SizeAttributeWhitelistComponent>(uid, out var whitelist))
return;

if (whitelist.Tall && component.Tall)
{
Scale(uid, component, whitelist.TallScale, whitelist.TallDensity, whitelist.TallCosmeticOnly);
PseudoItem(uid, component, whitelist.TallPseudoItem);
}
else if (whitelist.Short && component.Short)
{
Scale(uid, component, whitelist.ShortScale, whitelist.ShortDensity, whitelist.ShortCosmeticOnly);
PseudoItem(uid, component, whitelist.ShortPseudoItem);
}
}

private void PseudoItem(EntityUid uid, SizeAttributeComponent component, bool active)
{
if (active)
{
if (TryComp<PseudoItemComponent>(uid, out var pseudoI))
return;

_entityManager.AddComponent<PseudoItemComponent>(uid);
}
else
{
if (!TryComp<PseudoItemComponent>(uid, out var pseudoI))
return;

_entityManager.RemoveComponent<PseudoItemComponent>(uid);
}
}

private void Scale(EntityUid uid, SizeAttributeComponent component, float scale, float density, bool cosmeticOnly)
{
if (scale <= 0f && density <= 0f)
return;

_entityManager.EnsureComponent<ScaleVisualsComponent>(uid);

var appearanceComponent = _entityManager.EnsureComponent<AppearanceComponent>(uid);
if (!_appearance.TryGetData<Vector2>(uid, ScaleVisuals.Scale, out var oldScale, appearanceComponent))
oldScale = Vector2.One;

_appearance.SetData(uid, ScaleVisuals.Scale, oldScale * scale, appearanceComponent);

if (!cosmeticOnly && _entityManager.TryGetComponent(uid, out FixturesComponent? manager))
{
foreach (var (id, fixture) in manager.Fixtures)
{
if (!fixture.Hard || fixture.Density <= 1f)
continue; // This will skip the flammable fixture and any other fixture that is not supposed to contribute to mass

switch (fixture.Shape)
{
case PhysShapeCircle circle:
_physics.SetPositionRadius(uid, id, fixture, circle, circle.Position * scale, circle.Radius * scale, manager);
break;
default:
throw new NotImplementedException();
}

_physics.SetDensity(uid, id, fixture, density);
}
}
}
}

[ByRefEvent]
public readonly record struct ScaleEntityEvent(EntityUid Uid) { }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Robust.Shared.Physics.Collision.Shapes;

namespace Content.Server.SizeAttribute
{
[RegisterComponent]
public sealed partial class SizeAttributeWhitelistComponent : Component
{
// Short
[DataField("short")]
public bool Short = false;

[DataField("shortscale")]
public float ShortScale = 0f;

[DataField("shortDensity")]
public float ShortDensity = 0f;

[DataField("shortPseudoItem")]
public bool ShortPseudoItem = false;

[DataField("shortCosmeticOnly")]
public bool ShortCosmeticOnly = true;

// Tall
[DataField("tall")]
public bool Tall = false;

[DataField("tallscale")]
public float TallScale = 0f;

[DataField("tallDensity")]
public float TallDensity = 0f;

[DataField("tallPseudoItem")]
public bool TallPseudoItem = false;

[DataField("tallCosmeticOnly")]
public bool TallCosmeticOnly = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Content.Server.StationEvents.Events;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.StationEvents.Components;

[RegisterComponent, Access(typeof(TraderSpawnRule))]
public sealed partial class TraderSpawnRuleComponent : Component
{
[DataField("TraderShuttlePath")]
public string TraderShuttlePath = "Maps/Shuttles/trader.yml";
}
26 changes: 26 additions & 0 deletions Content.Server/ADT/StationEvents/Events/TraderSpawnRule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.Map;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.StationEvents.Components;

namespace Content.Server.StationEvents.Events;

public sealed class TraderSpawnRule : StationEventSystem<TraderSpawnRuleComponent>
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly MapLoaderSystem _map = default!;

protected override void Started(EntityUid uid, TraderSpawnRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);
var shuttleMap = _mapManager.CreateMap();
var options = new MapLoadOptions
{
LoadMap = true,
};

_map.TryLoad(shuttleMap, component.TraderShuttlePath, out _, options);
}
}

2 changes: 1 addition & 1 deletion Content.Server/Ame/AmeNodeGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public float CalculatePower(int fuel, int cores)
// Fuel is squared so more fuel vastly increases power and efficiency
// We divide by the number of cores so a larger AME is less efficient at the same fuel settings
// this results in all AMEs having the same efficiency at the same fuel-per-core setting
return 2000000f * fuel * fuel / cores;
return 80000f * fuel * fuel / cores;
}

public int GetTotalStability()
Expand Down
15 changes: 15 additions & 0 deletions Content.Server/Cloning/CloningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
using Robust.Shared.Physics.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Content.Shared.ADT.Cloning;
using Robust.Shared.Serialization.Manager;


namespace Content.Server.Cloning
{
Expand Down Expand Up @@ -60,6 +63,7 @@ public sealed class CloningSystem : EntitySystem
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
[Dependency] private readonly SharedJobSystem _jobs = default!;
[Dependency] private readonly ISerializationManager _serialization = default!;

public readonly Dictionary<MindComponent, EntityUid> ClonesWaitingForMind = new();
public const float EasyModeCloningCost = 0.7f;
Expand Down Expand Up @@ -219,6 +223,17 @@ public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Entity<MindComponen
if (!ev.NameHandled)
_metaSystem.SetEntityName(mob, MetaData(bodyToClone).EntityName);

// Transfer of special components, e.g. small/big traits
foreach (var comp in EntityManager.GetComponents(bodyToClone))
{
if (comp is ITransferredByCloning)
{
var copy = _serialization.CreateCopy(comp, notNullableOverride: true);
copy.Owner = mob;
EntityManager.AddComponent(mob, copy, overwrite: true);
}
}

var cloneMindReturn = EntityManager.AddComponent<BeingClonedComponent>(mob);
cloneMindReturn.Mind = mind;
cloneMindReturn.Parent = uid;
Expand Down
5 changes: 3 additions & 2 deletions Content.Server/Polymorph/Systems/PolymorphSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,9 @@ private void OnDestruction(Entity<PolymorphedEntityComponent> ent, ref Destructi
if (_mindSystem.TryGetMind(uid, out var mindId, out var mind))
_mindSystem.TransferTo(mindId, child, mind: mind);

SendToPausesdMap(uid, targetTransformComp);

EnsurePausedMap(); /// Апстрим: Может поломаться. Проверяйте.
if (PausedMap != null)
_transform.SetParent(uid, targetTransformComp, PausedMap.Value);
return child;
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Zombies/ZombieSystem.Transform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void ZombifyEntity(EntityUid target, MobStateComponent? mobState = null)
var melee = EnsureComp<MeleeWeaponComponent>(target);
melee.Animation = zombiecomp.AttackAnimation;
melee.WideAnimation = zombiecomp.AttackAnimation;
melee.Range = 2f;
melee.Range = 1.25f;

if (mobState.CurrentState == MobState.Alive)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public sealed partial class ChangelingComponent : Component
/// How fast the changeling will turn visible from movement when using chameleon skin.
/// </summary>
[DataField]
public float ChameleonSkinMovementVisibilityRate = 0.10f;
public float ChameleonSkinMovementVisibilityRate = 0.60f;
#endregion

#region Dissonant Shriek Ability
Expand Down
8 changes: 8 additions & 0 deletions Content.Shared/ADT/Cloning/ITransferredByCloning.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Content.Shared.ADT.Cloning;

/// <summary>
/// Indicates that this Component should be transferred to the new entity when the entity is cloned (for example, using a cloner)
/// </summary>
public interface ITransferredByCloning
{
}
19 changes: 19 additions & 0 deletions Content.Shared/ADT/Item/PseudoItemComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Content.Shared.ADT.Cloning;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Shared.Item.PseudoItem;
/// <summary>
/// For entities that behave like an item under certain conditions,
/// but not under most conditions.
/// </summary>
[RegisterComponent]
public sealed partial class PseudoItemComponent : Component, ITransferredByCloning
{
[DataField("size", customTypeSerializer: typeof(PrototypeIdSerializer<ItemSizePrototype>))]
public string Size = "Huge";

public bool Active = false;

[DataField]
public EntityUid? SleepAction;
}
7 changes: 4 additions & 3 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,14 @@ public static readonly CVarDef<bool>
*/

public static readonly CVarDef<int> ChangelingMinPlayers =
CVarDef.Create("changeling.min_players", 15);

CVarDef.Create("changeling.min_players", 20);

public static readonly CVarDef<int> ChangelingMaxChangelings =
CVarDef.Create("changeling.max_lings", 4); // Assuming average server maxes somewhere from like 50-80 people. Upd: У нас генокрады вместе с предателями, куда бля! Порезал в 2 раза лимит.
CVarDef.Create("changeling.max_lings", 3); // Assuming average server maxes somewhere from like 50-80 people. Upd: У нас генокрады вместе с предателями, куда бля! Порезал в 2 раза лимит.

public static readonly CVarDef<int> ChangelingPlayersPerChangeling =
CVarDef.Create("changeling.players_per_traitor", 10);
CVarDef.Create("changeling.players_per_traitor", 15);

public static readonly CVarDef<int> ChangelingMaxPicks =
CVarDef.Create("changeling.max_picks", 20);
Expand Down
20 changes: 10 additions & 10 deletions Content.Shared/Zombies/ZombieComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public sealed partial class ZombieComponent : Component, IAntagStatusIconCompone
public float MinZombieInfectionChance = 0.20f;

[ViewVariables(VVAccess.ReadWrite)]
public float ZombieMovementSpeedDebuff = 1.2f;
public float ZombieMovementSpeedDebuff = 0.9f;

/// <summary>
/// The skin color of the zombie
Expand Down Expand Up @@ -108,18 +108,18 @@ public sealed partial class ZombieComponent : Component, IAntagStatusIconCompone
{
DamageDict = new ()
{
{ "Blunt", -1.5 },
{ "Slash", -1.5 },
{ "Heat", -1 },
{ "Piercing", -1.5 }
{ "Blunt", -0.8 },
{ "Slash", -0.6 },
{ "Heat", -0.6 },
{ "Piercing", -0.6 }
}
};

/// <summary>
/// A multiplier applied to <see cref="PassiveHealing"/> when the entity is in critical condition.
/// </summary>
[DataField("passiveHealingCritMultiplier")]
public float PassiveHealingCritMultiplier = 5f;
public float PassiveHealingCritMultiplier = 3f;

/// <summary>
/// Healing given when a zombie bites a living being.
Expand All @@ -129,10 +129,10 @@ public sealed partial class ZombieComponent : Component, IAntagStatusIconCompone
{
DamageDict = new()
{
{ "Blunt", -8 },
{ "Slash", -8 },
{ "Heat", -4 },
{ "Piercing", -8 }
{ "Blunt", -4 },
{ "Slash", -4 },
{ "Heat", -2 },
{ "Piercing", -4 }
}
};

Expand Down
Loading

0 comments on commit f04df39

Please sign in to comment.