From c0cb414f178ee1ef5de201bdee7a8ed38846abf1 Mon Sep 17 00:00:00 2001 From: Aviu00 <93730715+Aviu00@users.noreply.github.com> Date: Wed, 21 Feb 2024 16:52:25 +0900 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=81=D1=8F=D0=BA=D0=BE=D0=B5=20(#104)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * - tweak: Revert mistakes. * - tweak: Limit tempgun max temperature. * - tweak: Gamemode tweaks. * - tweak: Shuttle aren't messy anymore. * - tweak: Vent critters spawn tweaks. * - tweak: No stamina cost for mining weapons. * - tweak: Better block. * - add: Cool attack animations. * - fix: Fix sprite. * - add: Stun baton now shows charge. * - tweak: Add cult to all in once. --- .../Rules/GameRuleSystem.Utility.cs | 7 +++ .../Rules/RevolutionaryRuleSystem.cs | 11 ++++- .../StationEvents/Events/VentCrittersRule.cs | 3 ++ .../ChangeTemperatureOnCollideComponent.cs | 8 ++++ .../ChangeTemperatureOnCollideSystem.cs | 14 ++++-- .../Weapons/Melee/MeleeWeaponComponent.cs | 11 ++++- .../Weapons/Melee/SharedMeleeWeaponSystem.cs | 48 +++++++++++-------- .../Prototypes/Entities/Mobs/NPCs/borer.yml | 20 +++++++- .../Objects/Weapons/Melee/pickaxe.yml | 2 + .../Entities/Objects/Weapons/security.yml | 2 +- Resources/Prototypes/GameRules/events.yml | 8 ++-- .../Prototypes/White/Damage/modifier_sets.yml | 2 +- .../Weapons/experimental_stunbaton.yml | 5 +- Resources/Prototypes/game_presets.yml | 5 +- 14 files changed, 111 insertions(+), 35 deletions(-) diff --git a/Content.Server/GameTicking/Rules/GameRuleSystem.Utility.cs b/Content.Server/GameTicking/Rules/GameRuleSystem.Utility.cs index 9d75e65472..756e2f466f 100644 --- a/Content.Server/GameTicking/Rules/GameRuleSystem.Utility.cs +++ b/Content.Server/GameTicking/Rules/GameRuleSystem.Utility.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Linq; using Content.Server.GameTicking.Rules.Components; using Content.Server.Station.Components; using Robust.Shared.Collections; @@ -107,6 +108,12 @@ public abstract partial class GameRuleSystem where T: IComponent targetGrid = RobustRandom.Pick(possibleTargets); + foreach (var target in possibleTargets.Where(HasComp)) // WD + { + targetGrid = target; + break; + } + if (!TryComp(targetGrid, out var gridComp)) return false; diff --git a/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs b/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs index 501784bd4c..34bf72b8f7 100644 --- a/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs @@ -13,6 +13,7 @@ using Content.Server.Revolutionary; using Content.Server.Revolutionary.Components; using Content.Server.Roles; using Content.Server.RoundEnd; +using Content.Server.StationEvents.Components; using Content.Shared.Chat; using Content.Shared.Database; using Content.Shared.Humanoid; @@ -51,6 +52,7 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem] public const string RevolutionaryNpcFaction = "Revolutionary"; @@ -87,8 +89,13 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem).Any()) + _roundEnd.DoRoundEndBehavior(RoundEndBehavior.ShuttleCall, component.ShuttleCallTime); + else + _roundEnd.EndRound(); + // WD EDIT END GameTicker.EndGameRule(uid, gameRule); } } diff --git a/Content.Server/StationEvents/Events/VentCrittersRule.cs b/Content.Server/StationEvents/Events/VentCrittersRule.cs index cdcf2bf6ff..8816a9c652 100644 --- a/Content.Server/StationEvents/Events/VentCrittersRule.cs +++ b/Content.Server/StationEvents/Events/VentCrittersRule.cs @@ -27,6 +27,9 @@ public sealed class VentCrittersRule : StationEventSystem(); while (locations.MoveNext(out _, out _, out var transform)) { + if (!HasComp(transform.GridUid)) // WD EDIT + continue; + if (CompOrNull(transform.GridUid)?.Station == station) { validLocations.Add(transform.Coordinates); diff --git a/Content.Server/_White/ChangeTemperatureOnCollide/ChangeTemperatureOnCollideComponent.cs b/Content.Server/_White/ChangeTemperatureOnCollide/ChangeTemperatureOnCollideComponent.cs index 2836e07e43..6103ecd554 100644 --- a/Content.Server/_White/ChangeTemperatureOnCollide/ChangeTemperatureOnCollideComponent.cs +++ b/Content.Server/_White/ChangeTemperatureOnCollide/ChangeTemperatureOnCollideComponent.cs @@ -1,3 +1,5 @@ +using Content.Shared.Atmos; + namespace Content.Server._White.ChangeTemperatureOnCollide; [RegisterComponent] @@ -6,6 +8,12 @@ public sealed partial class ChangeTemperatureOnCollideComponent : Component [DataField, ViewVariables(VVAccess.ReadWrite)] public float Temperature; + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float MinTemperature = Atmospherics.TCMB; + + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float MaxTemperature = 450; + [DataField] public string FixtureID = "projectile"; } diff --git a/Content.Server/_White/ChangeTemperatureOnCollide/ChangeTemperatureOnCollideSystem.cs b/Content.Server/_White/ChangeTemperatureOnCollide/ChangeTemperatureOnCollideSystem.cs index 05df58c2c3..c4c8df674f 100644 --- a/Content.Server/_White/ChangeTemperatureOnCollide/ChangeTemperatureOnCollideSystem.cs +++ b/Content.Server/_White/ChangeTemperatureOnCollide/ChangeTemperatureOnCollideSystem.cs @@ -1,6 +1,5 @@ using Content.Server.Temperature.Components; using Content.Server.Temperature.Systems; -using Content.Shared.Atmos; using Robust.Shared.Physics.Events; namespace Content.Server._White.ChangeTemperatureOnCollide; @@ -24,7 +23,16 @@ public sealed class ChangeTemperatureOnCollideSystem : EntitySystem if (!TryComp(args.OtherEntity, out TemperatureComponent? temperature)) return; - _temperature.ForceChangeTemperature(args.OtherEntity, - MathF.Max(Atmospherics.TCMB, temperature.CurrentTemperature + component.Temperature), temperature); + var curTemp = temperature.CurrentTemperature; + var newTemp = curTemp + component.Temperature; + + if (curTemp < component.MinTemperature) + newTemp = MathF.Max(curTemp, newTemp); + else if (curTemp > component.MaxTemperature) + newTemp = MathF.Min(curTemp, newTemp); + else + newTemp = Math.Clamp(newTemp, component.MinTemperature, component.MaxTemperature); + + _temperature.ForceChangeTemperature(args.OtherEntity, newTemp, temperature); } } diff --git a/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs b/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs index f284671182..0651ff2187 100644 --- a/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs +++ b/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs @@ -66,6 +66,15 @@ public sealed partial class MeleeWeaponComponent : Component [ViewVariables(VVAccess.ReadWrite), DataField] public bool IgnoreResistances; + + [ViewVariables(VVAccess.ReadWrite), DataField] + public float HeavyAttackStaminaCost = 8; + + [ViewVariables(VVAccess.ReadWrite), DataField] + public EntProtoId MissAnimation = "WeaponArcPunch"; + + [ViewVariables(VVAccess.ReadWrite), DataField] + public EntProtoId DisarmAnimation = "WeaponArcDisarm"; // WD END /// @@ -105,7 +114,7 @@ public sealed partial class MeleeWeaponComponent : Component public Angle Angle = Angle.FromDegrees(60); [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] - public EntProtoId Animation = "WeaponArcPunch"; + public EntProtoId Animation = "WeaponArcThrust"; // WD EDIT [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] public EntProtoId WideAnimation = "WeaponArcSlash"; diff --git a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs index 902c21d1b7..a1e6c71834 100644 --- a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs +++ b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs @@ -428,14 +428,14 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem switch (attack) { case LightAttackEvent light: - DoLightAttack(user, light, weaponUid, weapon, session); - animation = weapon.Animation; + DoLightAttack(user, light, weaponUid, weapon, session, out var anim); // WD EDIT + animation = anim ?? weapon.Animation; // WD EDIT break; case DisarmAttackEvent disarm: if (!DoDisarm(user, disarm, weaponUid, weapon, session)) return false; - animation = weapon.Animation; + animation = weapon.DisarmAnimation; // WD EDIT break; case HeavyAttackEvent heavy: if (!DoHeavyAttack(user, heavy, weaponUid, weapon, session)) @@ -459,8 +459,9 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem protected abstract bool InRange(EntityUid user, EntityUid target, float range, ICommonSession? session); - protected virtual void DoLightAttack(EntityUid user, LightAttackEvent ev, EntityUid meleeUid, MeleeWeaponComponent component, ICommonSession? session) + protected virtual void DoLightAttack(EntityUid user, LightAttackEvent ev, EntityUid meleeUid, MeleeWeaponComponent component, ICommonSession? session, out string? animation) // WD EDIT { + animation = null; // WD EDIT // If I do not come back later to fix Light Attacks being Heavy Attacks you can throw me in the spider pit -Errant var damage = GetDamage(meleeUid, user, component) * GetHeavyDamageModifier(meleeUid, user, component); var target = GetEntity(ev.Target); @@ -489,18 +490,13 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem var missEvent = new MeleeHitEvent(new List(), user, meleeUid, damage, null); RaiseLocalEvent(meleeUid, missEvent); Audio.PlayPredicted(component.SwingSound, meleeUid, user); + if (component.Animation == "WeaponArcThrust") // WD EDIT + animation = component.MissAnimation; return; } // Sawmill.Debug($"Melee damage is {damage.Total} out of {component.Damage.Total}"); - // Raise event before doing damage so we can cancel damage if the event is handled - var hitEvent = new MeleeHitEvent(new List { target.Value }, user, meleeUid, damage, null); - RaiseLocalEvent(meleeUid, hitEvent); - - if (hitEvent.Handled) - return; - // WD START var blockEvent = new MeleeBlockAttemptEvent(user); RaiseLocalEvent(target.Value, ref blockEvent); @@ -508,6 +504,13 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem return; // WD END + // Raise event before doing damage so we can cancel damage if the event is handled + var hitEvent = new MeleeHitEvent(new List { target.Value }, user, meleeUid, damage, null); + RaiseLocalEvent(meleeUid, hitEvent); + + if (hitEvent.Handled) + return; + var targets = new List(1) { target.Value @@ -579,7 +582,8 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem var entities = GetEntityList(ev.Entities); // WD EDIT - _stamina.TakeStaminaDamage(user, 7); + if (component.HeavyAttackStaminaCost > 0) + _stamina.TakeStaminaDamage(user, component.HeavyAttackStaminaCost); // WD EDIT END if (entities.Count == 0) @@ -634,6 +638,19 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem // Sawmill.Debug($"Melee damage is {damage.Total} out of {component.Damage.Total}"); + // WD START + foreach (var target in new List(targets)) + { + var blockEvent = new MeleeBlockAttemptEvent(user); + RaiseLocalEvent(target, ref blockEvent); + if (blockEvent.Blocked) + targets.Remove(target); + } + + if (targets.Count == 0) + return true; + // WD END + // Raise event before doing damage so we can cancel damage if the event is handled var hitEvent = new MeleeHitEvent(targets, user, meleeUid, damage, direction); RaiseLocalEvent(meleeUid, hitEvent); @@ -666,13 +683,6 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem if (!Blocker.CanAttack(user, entity, (weapon, component))) continue; - // WD START - var blockEvent = new MeleeBlockAttemptEvent(user); - RaiseLocalEvent(entity, ref blockEvent); - if (blockEvent.Blocked) - continue; - // WD END - var attackedEvent = new AttackedEvent(meleeUid, user, GetCoordinates(ev.Coordinates)); RaiseLocalEvent(entity, attackedEvent); var modifiedDamage = DamageSpecifier.ApplyModifierSets(damage + hitEvent.BonusDamage + attackedEvent.BonusDamage, hitEvent.ModifiersList); diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/borer.yml b/Resources/Prototypes/Entities/Mobs/NPCs/borer.yml index baee1f402d..b938652dcf 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/borer.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/borer.yml @@ -69,4 +69,22 @@ components: - type: Borer reproduceCost: 100 - assumeControlCost: 250 \ No newline at end of file + assumeControlCost: 250 + +- type: entity + id: SpawnPointGhostBorer + name: ghost role spawn point + suffix: coartical borer + parent: MarkerBase + components: + - type: GhostRole + name: ghost-role-information-borer-name + description: ghost-role-information-borer-description + - type: GhostRoleMobSpawner + prototype: MobSimpleBorer + - type: Sprite + sprite: Markers/jobs.rsi + layers: + - state: green + - sprite: Mobs/Animals/borer.rsi + state: borer diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/pickaxe.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/pickaxe.yml index 21c1cedd01..720b6e1733 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/pickaxe.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/pickaxe.yml @@ -11,6 +11,7 @@ sprite: Objects/Weapons/Melee/pickaxe.rsi state: pickaxe - type: MeleeWeapon + heavyAttackStaminaCost: 0 # For mining attackRate: 0.7 wideAnimationRotation: -135 soundHit: @@ -49,6 +50,7 @@ sprite: Objects/Tools/handdrill.rsi state: handdrill - type: MeleeWeapon + heavyAttackStaminaCost: 0 # For mining autoAttack: true angle: 0 wideAnimationRotation: -90 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/security.yml b/Resources/Prototypes/Entities/Objects/Weapons/security.yml index 12131bab2f..f2240516b7 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/security.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/security.yml @@ -38,13 +38,13 @@ Blunt: 7 bluntStaminaDamageFactor: 2.0 angle: 60 - animation: WeaponArcSlash - type: StaminaDamageOnHit damage: 40 sound: /Audio/Weapons/egloves.ogg - type: StaminaDamageOnCollide damage: 40 sound: /Audio/Weapons/egloves.ogg + - type: ExaminableBattery - type: Battery maxCharge: 1000 startingCharge: 1000 diff --git a/Resources/Prototypes/GameRules/events.yml b/Resources/Prototypes/GameRules/events.yml index ad5af8d899..cbf7a9c568 100644 --- a/Resources/Prototypes/GameRules/events.yml +++ b/Resources/Prototypes/GameRules/events.yml @@ -373,7 +373,7 @@ entries: - id: MobGiantSpiderAngry prob: 0.05 - + - type: entity id: BorerSpawn parent: BaseGameRule @@ -389,9 +389,9 @@ startAudio: path: /Audio/Announcements/attention.ogg - type: VentCrittersRule - entries: - - id: MobSimpleBorer - prob: 0.04 + specialEntries: + - id: SpawnPointGhostBorer + prob: 0.03 - type: entity id: SpiderClownSpawn diff --git a/Resources/Prototypes/White/Damage/modifier_sets.yml b/Resources/Prototypes/White/Damage/modifier_sets.yml index 39cd200fa4..6dd3c5cb0d 100644 --- a/Resources/Prototypes/White/Damage/modifier_sets.yml +++ b/Resources/Prototypes/White/Damage/modifier_sets.yml @@ -8,7 +8,7 @@ - type: damageModifierSet id: Dwarf coefficients: - Blunt: 0.7 + Blunt: 0.9 Slash: 1.2 Piercing: 1.2 diff --git a/Resources/Prototypes/White/Entities/Objects/Weapons/experimental_stunbaton.yml b/Resources/Prototypes/White/Entities/Objects/Weapons/experimental_stunbaton.yml index f9d243c749..24e4a7c6e5 100644 --- a/Resources/Prototypes/White/Entities/Objects/Weapons/experimental_stunbaton.yml +++ b/Resources/Prototypes/White/Entities/Objects/Weapons/experimental_stunbaton.yml @@ -9,7 +9,6 @@ - type: Sprite sprite: White/Objects/Weapons/experimental_stunbaton.rsi - type: Stunbaton - energyPerUse: 100 - type: MeleeWeapon damage: types: @@ -17,7 +16,9 @@ bluntStaminaDamageFactor: 2.0 angle: 70 - type: StaminaDamageOnHit - damage: 80 + damage: 45 + - type: StaminaDamageOnCollide + damage: 45 - type: Battery maxCharge: 2000 startingCharge: 2000 diff --git a/Resources/Prototypes/game_presets.yml b/Resources/Prototypes/game_presets.yml index 88dd056898..2718b4a626 100644 --- a/Resources/Prototypes/game_presets.yml +++ b/Resources/Prototypes/game_presets.yml @@ -20,6 +20,9 @@ - Revolutionary - Zombie - RampingStationEventScheduler + - Changeling + - Cult + - BasicRoundstartVariation - type: gamePreset id: Extended @@ -102,7 +105,7 @@ - changeling name: changeling-title description: changeling-description - showInVote: false + showInVote: true rules: - Changeling - BasicStationEventScheduler