ADAPTATION

This commit is contained in:
Ed
2025-07-08 11:46:35 +03:00
parent 7a8326d41e
commit 3f7bb1f5c6
17 changed files with 28 additions and 162 deletions

View File

@@ -11,7 +11,6 @@ namespace Content.Server.Fluids.EntitySystems;
public sealed partial class PuddleSystem
{
[Dependency] private readonly SharedMapSystem _maps = default!; //CP14
[Dependency] private readonly WeatherSystem _weather = default!; //CP14
private static readonly TimeSpan EvaporationCooldown = TimeSpan.FromSeconds(1);
@@ -24,7 +23,7 @@ public sealed partial class PuddleSystem
var xform = Transform(entity);
if (TryComp<MapGridComponent>(xform.GridUid, out var mapGrid))
{
var tileRef = _maps.GetTileRef(xform.GridUid.Value, mapGrid, xform.Coordinates);
var tileRef = _map.GetTileRef(xform.GridUid.Value, mapGrid, xform.Coordinates);
entity.Comp.CP14ForceEvaporation = _weather.CanWeatherAffect(xform.GridUid.Value, mapGrid, tileRef);
}
//CP14 End force evaporation under sky

View File

@@ -13,6 +13,7 @@ using Content.Shared.Item.ItemToggle.Components;
using Content.Shared.MedicalScanner;
using Content.Shared.Mobs.Components;
using Content.Shared.Popups;
using Content.Shared.Traits.Assorted;
using Robust.Server.GameObjects;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;

View File

@@ -137,23 +137,6 @@ public sealed partial class ShuttleSystem
var parallax = EnsureComp<ParallaxComponent>(mapUid);
parallax.Parallax = ftlMap.Parallax;
//CP14 FTL map tweaks
var mapLight = EnsureComp<MapLightComponent>(mapUid);
mapLight.AmbientLightColor = ftlMap.AmbientColor;
var moles = new float[Atmospherics.AdjustedNumberOfGases];
moles[(int) Gas.Oxygen] = 21.824779f;
moles[(int) Gas.Nitrogen] = 82.10312f;
var mixture = new GasMixture(moles, Atmospherics.T20C);
_atmos.SetMapAtmosphere(mapUid, false, mixture);
var gravity = EnsureComp<GravityComponent>(mapUid);
gravity.Enabled = true;
gravity.Inherent = true;
//CP14 FTL map tweaks ends
return mapUid;
}

View File

@@ -117,7 +117,7 @@ public sealed partial class CP14DemiplaneSystem : CP14SharedDemiplaneSystem
if (entity is null)
return;
_flash.Flash(entity.Value, null, null, 3000f, 0.5f);
_flash.Flash(entity.Value, null, null, TimeSpan.FromSeconds(3f), 0.5f);
_transform.SetCoordinates(entity.Value, coordinates);
_audio.PlayGlobal(sound, entity.Value);
}

View File

@@ -83,7 +83,7 @@ public sealed class CP14VampireRuleSystem : GameRuleSystem<CP14VampireRuleCompon
private void OnVampireInit(Entity<CP14VampireComponent> ent, ref MapInitEvent args)
{
_bloodstream.ChangeBloodReagent(ent, ent.Comp.NewBloodReagent);
_bloodstream.ChangeBloodReagent(ent.Owner, ent.Comp.NewBloodReagent);
foreach (var (organUid, _) in _body.GetBodyOrgans(ent))
{

View File

@@ -24,10 +24,11 @@ public sealed partial class CP14FireSpreadSystem : CP14SharedFireSpreadSystem
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
[Dependency] private readonly SharedMapSystem _map = default!;
[Dependency] private readonly TileSystem _tile = default!;
[Dependency] private readonly ITileDefinitionManager _tileDef = default!;
[Dependency] private readonly SmokingSystem _smoking = default!;
[Dependency] private readonly TurfSystem _turf = default!;
private readonly EntProtoId _fireProto = "CP14Fire";
@@ -160,7 +161,7 @@ public sealed partial class CP14FireSpreadSystem : CP14SharedFireSpreadSystem
return;
var localPos = xform.Coordinates.Position;
var tileRefs = _mapSystem.GetLocalTilesIntersecting(xform.ParentUid,
var tileRefs = _map.GetLocalTilesIntersecting(xform.ParentUid,
grid,
new Box2(
localPos + new Vector2(-spread.Comp.Radius, -spread.Comp.Radius),
@@ -172,12 +173,12 @@ public sealed partial class CP14FireSpreadSystem : CP14SharedFireSpreadSystem
if (!_random.Prob(spread.Comp.ProbTile))
continue;
var tile = tileRef.Tile.GetContentTileDefinition();
var tile = _turf.GetContentTileDefinition(tileRef);
if (tile.BurnedTile is null)
continue;
Spawn(_fireProto, _mapSystem.ToCenterCoordinates(tileRef, grid));
Spawn(_fireProto, _map.ToCenterCoordinates(tileRef, grid));
_tile.ReplaceTile(tileRef, (ContentTileDefinition)_tileDef[tile.BurnedTile]);
}
}

View File

@@ -18,6 +18,7 @@ public abstract partial class CP14SharedFarmingSystem
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly EntityTableSystem _entityTable = default!;
[Dependency] private readonly TurfSystem _turf = default!;
private void InitializeInteractions()
{
@@ -186,12 +187,9 @@ public abstract partial class CP14SharedFarmingSystem
if (!TryComp<MapGridComponent>(map, out var gridComp))
return false;
var tileRef = position.GetTileRef();
var tileRef = _map.GetTileRef(map.Value, gridComp, position);
if (tileRef is null)
return false;
var tile = tileRef.Value.Tile.GetContentTileDefinition();
var tile = _turf.GetContentTileDefinition(tileRef);
if (!seed.Comp.SoilTile.Contains(tile))
{

View File

@@ -6,6 +6,7 @@ using Content.Shared._CP14.Religion.Systems;
using Content.Shared.CombatMode.Pacification;
using Content.Shared.Damage.Components;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Popups;
@@ -18,6 +19,7 @@ public abstract partial class CP14SharedMagicSystem
{
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly CP14SharedReligionGodSystem _god = default!;
[Dependency] private readonly SharedHandsSystem _hand = default!;
private void InitializeChecks()
{
@@ -89,14 +91,7 @@ public abstract partial class CP14SharedMagicSystem
{
if (TryComp<HandsComponent>(args.Performer, out var hands) || hands is not null)
{
var freeHand = 0;
foreach (var hand in hands.Hands)
{
if (hand.Value.IsEmpty)
freeHand++;
}
if (freeHand >= ent.Comp.FreeHandRequired)
if (_hand.CountFreeableHands((args.Performer, hands)) >= ent.Comp.FreeHandRequired)
return;
}

View File

@@ -3,16 +3,13 @@ using Content.Shared.Bed.Sleep;
using Content.Shared.Damage;
using Content.Shared.IdentityManagement;
using Content.Shared.Popups;
using Content.Shared.StatusEffect;
using Content.Shared.StatusEffectNew;
namespace Content.Shared._CP14.MagicWeakness;
public abstract class CP14SharedMagicWeaknessSystem : EntitySystem
{
[ValidatePrototypeId<StatusEffectPrototype>]
private const string StatusEffectKey = "ForcedSleep";
[Dependency] private readonly StatusEffectsSystem _statusEffects = default!;
[Dependency] private readonly SharedStatusEffectsSystem _statusEffects = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
@@ -36,10 +33,10 @@ public abstract class CP14SharedMagicWeaknessSystem : EntitySystem
ent,
ent,
PopupType.LargeCaution);
_statusEffects.TryAddStatusEffect<ForcedSleepingComponent>(ent,
StatusEffectKey,
TimeSpan.FromSeconds(ent.Comp.SleepPerEnergy * (float)args.BurnOutEnergy),
false);
_statusEffects.TryAddStatusEffectDuration(
ent,
SleepingSystem.StatusEffectForcedSleeping,
TimeSpan.FromSeconds(ent.Comp.SleepPerEnergy * (float)args.BurnOutEnergy));
}
}
@@ -52,10 +49,10 @@ public abstract class CP14SharedMagicWeaknessSystem : EntitySystem
ent,
ent,
PopupType.LargeCaution);
_statusEffects.TryAddStatusEffect<ForcedSleepingComponent>(ent,
StatusEffectKey,
TimeSpan.FromSeconds(ent.Comp.SleepPerEnergy * (float)args.OverloadEnergy),
false);
_statusEffects.TryAddStatusEffectDuration(
ent,
SleepingSystem.StatusEffectForcedSleeping,
TimeSpan.FromSeconds(ent.Comp.SleepPerEnergy * (float)args.OverloadEnergy));
}
}

View File

@@ -1,25 +0,0 @@
using Robust.Shared.Audio;
namespace Content.Shared._CP14.MeleeWeapon.Components;
/// <summary>
/// allows this item to be knocked out of your hands by a successful parry
/// </summary>
[RegisterComponent]
public sealed partial class CP14MeleeParriableComponent : Component
{
/// <summary>
///
/// </summary>
[DataField]
public TimeSpan LastMeleeHit = TimeSpan.Zero;
/// <summary>
///
/// </summary>
[DataField]
public float NeedParryPower = 1f;
[DataField]
public SoundSpecifier ParrySound = new SoundCollectionSpecifier("CP14Parry", AudioParams.Default.WithVariation(0.05f));
}

View File

@@ -1,14 +0,0 @@
namespace Content.Shared._CP14.MeleeWeapon.Components;
/// <summary>
/// attacks with this item may knock CP14ParriableComponent items out of your hand on a hit
/// </summary>
[RegisterComponent]
public sealed partial class CP14MeleeParryComponent : Component
{
[DataField]
public TimeSpan ParryWindow = TimeSpan.FromSeconds(1f);
[DataField]
public float ParryPower = 1f;
}

View File

@@ -1,63 +0,0 @@
using Content.Shared._CP14.MeleeWeapon.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Popups;
using Content.Shared.Throwing;
using Content.Shared.Weapons.Melee.Events;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Random;
using Robust.Shared.Timing;
namespace Content.Shared._CP14.MeleeWeapon.EntitySystems;
public sealed class CP14MeleeParrySystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly IGameTiming _timing = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CP14MeleeParryComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<CP14MeleeParriableComponent, AttemptMeleeEvent>(OnMeleeParriableHitAttempt);
}
private void OnMeleeParriableHitAttempt(Entity<CP14MeleeParriableComponent> ent, ref AttemptMeleeEvent args)
{
ent.Comp.LastMeleeHit = _timing.CurTime;
}
private void OnMeleeHit(Entity<CP14MeleeParryComponent> ent, ref MeleeHitEvent args)
{
if (args.HitEntities.Count != 1)
return;
var target = args.HitEntities[0];
var activeTargetHand = _hands.GetActiveHand(target);
if (activeTargetHand?.HeldEntity is null)
return;
var parriedWeapon = activeTargetHand.HeldEntity.Value;
if (!TryComp<CP14MeleeParriableComponent>(parriedWeapon, out var meleeParriable))
return;
if (ent.Comp.ParryPower < meleeParriable.NeedParryPower)
return;
if (_timing.CurTime > meleeParriable.LastMeleeHit + ent.Comp.ParryWindow)
return;
_hands.TryDrop(target, parriedWeapon);
_throwing.TryThrow(parriedWeapon, _random.NextAngle().ToWorldVec(), ent.Comp.ParryPower, target);
_popup.PopupEntity( Loc.GetString("cp14-successful-parry"), args.User, args.User);
_popup.PopupEntity( Loc.GetString("cp14-successful-parry"), args.HitEntities[0], args.HitEntities[0]);
_audio.PlayPvs(meleeParriable.ParrySound, parriedWeapon);
}
}

View File

@@ -15,6 +15,7 @@ public sealed class CP14EditTileToolSystem : EntitySystem
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly TurfSystem _turf = default!;
public override void Initialize()
{
@@ -55,12 +56,9 @@ public sealed class CP14EditTileToolSystem : EntitySystem
if (!TryComp<MapGridComponent>(map, out var gridComp))
return;
var tileRef = location.GetTileRef();
var tileRef = _map.GetTileRef(map.Value, gridComp, location);
if (tileRef is null)
return;
var tile = tileRef.Value.Tile.GetContentTileDefinition();
var tile = _turf.GetContentTileDefinition(tileRef);
if (!ent.Comp.TileReplace.TryGetValue(tile, out var replaceTile))
return;

View File

@@ -67,7 +67,6 @@
breakOnMove: false
slots:
- belt
- type: CP14MeleeParriable
- type: Item
shape:
- 0,0,0,1

View File

@@ -30,7 +30,6 @@
unequipDelay: 0.25
quickEquip: false
breakOnMove: false
- type: CP14MeleeParriable
- type: CP14LabeledRenaming
- type: entity

View File

@@ -105,7 +105,6 @@
collection: MetalBreak
- !type:DoActsBehavior
acts: ["Destruction"]
- type: CP14MeleeParriable
- type: entity
abstract: true

View File

@@ -86,5 +86,4 @@
CP14WoodenPlanks1:
min: 1
max: 2
- type: CP14MeleeParry