From 89d2e107923acfd90ef17fc32d4a28262b29c4bc Mon Sep 17 00:00:00 2001 From: Cvasic Date: Tue, 7 Nov 2023 23:37:05 +0400 Subject: [PATCH 1/5] =?UTF-8?q?=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Backmen/Spider/SpiderVampireSystem.cs | 110 ++++++++++++++++++ .../IgnoreSpiderWebArachneClassicComponent.cs | 2 +- .../Components/SpiderVampireComponent.cs | 32 +++++ .../Components/SpiderVampireEggActionEvent.cs | 5 + .../Prototypes/Backmen/Actions/arachne.yml | 13 +++ .../Backmen/Entities/Mobs/NPC/animals.yml | 15 +++ .../Backmen/Entities/Mobs/NPC/mutants.yml | 2 + .../Entities/Objects/Consumable/Food/egg.yml | 76 ++++++++++++ Resources/Prototypes/Backmen/tags.yml | 6 + .../Misc/eggspider.rsi/blue-inhand-left.png | Bin 0 -> 183 bytes .../Misc/eggspider.rsi/blue-inhand-right.png | Bin 0 -> 189 bytes .../Objects/Misc/eggspider.rsi/eggshells.png | Bin 0 -> 213 bytes .../Objects/Misc/eggspider.rsi/icon.png | Bin 0 -> 326 bytes .../Objects/Misc/eggspider.rsi/meta.json | 22 ++++ 14 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 Content.Server/Backmen/Spider/SpiderVampireSystem.cs rename Content.Shared/Backmen/Spider/{ => Components}/IgnoreSpiderWebArachneClassicComponent.cs (65%) create mode 100644 Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs create mode 100644 Content.Shared/Backmen/Spider/Components/SpiderVampireEggActionEvent.cs create mode 100644 Resources/Prototypes/Backmen/Entities/Mobs/NPC/animals.yml create mode 100644 Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml create mode 100644 Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/blue-inhand-left.png create mode 100644 Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/blue-inhand-right.png create mode 100644 Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/eggshells.png create mode 100644 Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/icon.png create mode 100644 Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/meta.json diff --git a/Content.Server/Backmen/Spider/SpiderVampireSystem.cs b/Content.Server/Backmen/Spider/SpiderVampireSystem.cs new file mode 100644 index 00000000000..7cc3d67a622 --- /dev/null +++ b/Content.Server/Backmen/Spider/SpiderVampireSystem.cs @@ -0,0 +1,110 @@ +using Content.Shared.Backmen.Spider.Components; +using Robust.Shared.Prototypes; +using Content.Server.Actions; +using Content.Shared.Nutrition.EntitySystems; +using Content.Shared.Mobs.Systems; +using Content.Server.Popups; +using Robust.Shared.GameObjects; +using Content.Shared.DoAfter; +using Robust.Shared.Audio; +using Content.Shared.Nutrition.AnimalHusbandry; +using Content.Shared.Nutrition.Components; +using Content.Server.Administration.Logs; +using Robust.Shared.Random; +using Robust.Shared.Player; +using Content.Shared.Database; +using Content.Shared.IdentityManagement; + +namespace Content.Server.Backmen.Spider; + + + +public sealed class SpiderVampireSystem : EntitySystem +{ + [Dependency] private readonly ActionsSystem _action = default!; + [Dependency] private readonly MobStateSystem _mobState = default!; + [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!; + [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly HungerSystem _hunger = default!; + [Dependency] private readonly IAdminLogManager _adminLog = default!; + [Dependency] private readonly IRobustRandom _random = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnActionEggUsed); + SubscribeLocalEvent(OnActionEggUsedAfter); + + SubscribeLocalEvent(OnMapInit); + } + +#region Добавить скилл + + [ValidatePrototypeId] private const string SpiderVampireEggAction = "ActionSpiderVampireEgg"; + + private void OnMapInit(EntityUid uid, SpiderVampireComponent component, MapInitEvent args) + { + _action.AddAction(uid, ref component.SpiderVampireEggAction, SpiderVampireEggAction); + } +#endregion + +#region Нажали на кнопку + private static readonly SoundSpecifier HairballPlay = new SoundPathSpecifier("/Audio/Backmen/Effects/Species/hairball.ogg", AudioParams.Default.WithVariation(0.15f)); + private void OnActionEggUsed(EntityUid uid, SpiderVampireComponent component, SpiderVampireEggActionEvent args) + { + if (args.Handled) + return; + + if (HasComp(uid)) + { + _popupSystem.PopupEntity("Еще не дорос", uid, uid); + return; + } + + if (_mobState.IsIncapacitated(uid)) + { + _popupSystem.PopupEntity("хуйня какая-то", uid, uid); + return; + } + + if (TryComp(uid, out var hunger) && _hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay) + { + _popupSystem.PopupEntity("жрать хочу", uid, uid); + return; + } + + if (TryComp(uid, out var thirst) && thirst.CurrentThirstThreshold < ThirstThreshold.Okay) + { + _popupSystem.PopupEntity("пить хочу", uid, uid); + return; + } + + _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, uid, component.UsingEggTime, new SpiderVampireEggDoAfterEvent(), uid, used: uid) + { + BreakOnTargetMove = true, + BreakOnUserMove = true, + BreakOnDamage = true, + }); + + _audio.Play(HairballPlay, Filter.Pvs(uid, entityManager: EntityManager), Transform(uid).Coordinates, true, AudioParams.Default.WithVariation(0.025f)); + args.Handled = true; + } +#endregion + +#region После каста + private void OnActionEggUsedAfter(EntityUid uid, SpiderVampireComponent component, SpiderVampireEggDoAfterEvent args) + { + if (args.Handled || args.Cancelled) + return; + var xform = Transform(uid); + var offspring = Spawn(component.SpawnEgg, xform.Coordinates.Offset(_random.NextVector2(0.3f))); + _hunger.ModifyHunger(uid, -component.HungerPerBirth); + _adminLog.Add(LogType.Action, $"{ToPrettyString(uid)} gave birth to {ToPrettyString(offspring)}."); + _popupSystem.PopupEntity(Loc.GetString("reproductive-birth-popup", ("parent", Identity.Entity(uid, EntityManager))), uid); + } +#endregion +} + + diff --git a/Content.Shared/Backmen/Spider/IgnoreSpiderWebArachneClassicComponent.cs b/Content.Shared/Backmen/Spider/Components/IgnoreSpiderWebArachneClassicComponent.cs similarity index 65% rename from Content.Shared/Backmen/Spider/IgnoreSpiderWebArachneClassicComponent.cs rename to Content.Shared/Backmen/Spider/Components/IgnoreSpiderWebArachneClassicComponent.cs index e5ffb222bc3..4a0672ff198 100644 --- a/Content.Shared/Backmen/Spider/IgnoreSpiderWebArachneClassicComponent.cs +++ b/Content.Shared/Backmen/Spider/Components/IgnoreSpiderWebArachneClassicComponent.cs @@ -1,4 +1,4 @@ -namespace Content.Shared.Backmen.Spider; +namespace Content.Shared.Backmen.Spider.Components; [RegisterComponent] public sealed partial class IgnoreSpiderWebArachneClassicComponent : Component diff --git a/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs b/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs new file mode 100644 index 00000000000..13e46dcadf7 --- /dev/null +++ b/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs @@ -0,0 +1,32 @@ + +using Robust.Shared.GameStates; +using Content.Shared.DoAfter; +using Robust.Shared.Serialization; +using Robust.Shared.Prototypes; + +namespace Content.Shared.Backmen.Spider.Components; + + +[RegisterComponent, NetworkedComponent] +public sealed partial class SpiderVampireComponent : Component +{ + public EntityUid? SpiderVampireEggAction; + [DataField] + public float UsingEggTime = 20; + + [DataField] + public EntProtoId SpawnEgg = default!; + + /// + /// How much hunger is consumed when an entity + /// gives birth. A balancing tool to require feeding. + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float HungerPerBirth = 75f; +} + +[Serializable, NetSerializable] +public sealed partial class SpiderVampireEggDoAfterEvent : SimpleDoAfterEvent +{ + +} diff --git a/Content.Shared/Backmen/Spider/Components/SpiderVampireEggActionEvent.cs b/Content.Shared/Backmen/Spider/Components/SpiderVampireEggActionEvent.cs new file mode 100644 index 00000000000..0a6952a9e44 --- /dev/null +++ b/Content.Shared/Backmen/Spider/Components/SpiderVampireEggActionEvent.cs @@ -0,0 +1,5 @@ +using Content.Shared.Actions; + +namespace Content.Shared.Backmen.Spider.Components; + +public sealed partial class SpiderVampireEggActionEvent : InstantActionEvent {} diff --git a/Resources/Prototypes/Backmen/Actions/arachne.yml b/Resources/Prototypes/Backmen/Actions/arachne.yml index acc29177be5..b00468d8402 100644 --- a/Resources/Prototypes/Backmen/Actions/arachne.yml +++ b/Resources/Prototypes/Backmen/Actions/arachne.yml @@ -8,3 +8,16 @@ useDelay: 180 icon: Interface/Actions/web.png event: !type:SpiderWebActionEvent + +- type: entity + id: ActionSpiderVampireEgg + name: name Spider Vampire Egg + description: description Spider Vampire Egg + noSpawn: true + components: + - type: InstantAction + icon: { sprite: Backmen/Objects/Misc/eggspider.rsi, state: icon } + priority: -10 + event: !type:SpiderVampireEggActionEvent + charges: 1 + useDelay: 30 diff --git a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/animals.yml b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/animals.yml new file mode 100644 index 00000000000..4fcef27cdda --- /dev/null +++ b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/animals.yml @@ -0,0 +1,15 @@ +- type: entity + id: FoodEggSpiderFertilizedVampire + parent: FoodEggSpiderVampire + suffix: Оплодотворенный, Вампир + components: + - type: Timer + - type: TimedSpawner + prototypes: + - MobGiantSpiderVampireAngry + intervalSeconds: 10 + minimumEntitiesSpawned: 1 + maximumEntitiesSpawned: 1 + - type: TimedDespawn + lifetime: 11 + diff --git a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml index a4c955dcbc1..cdc260615bc 100644 --- a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml +++ b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml @@ -188,6 +188,8 @@ whitelist: tags: - ArachneWeb + - type: SpiderVampire + spawnEgg: FoodEggSpiderFertilizedVampire - type: entity name: Чёрная вдова diff --git a/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml b/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml new file mode 100644 index 00000000000..c120299b36b --- /dev/null +++ b/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml @@ -0,0 +1,76 @@ +- type: entity + parent: [FoodInjectableBase, ItemHeftyBase] + id: FoodEggBaseVampire + description: An egg! + abstract: true + components: + - type: Tag + tags: + - EggVampire + - MeatVampire + - type: Food + trash: Eggshells + - type: Sprite + sprite: Backmen/Objects/Misc/eggspider.rsi + - type: Item + sprite: Backmen/Objects/Misc/eggspider.rsi + size: Tiny + - type: SolutionContainerManager + solutions: + food: + maxVol: 6 + reagents: + - ReagentId: Egg + Quantity: 6 + - type: SolutionSpiker + sourceSolution: food + ignoreEmpty: true + popup: spike-solution-egg + - type: DeleteOnTrigger + - type: DamageOnHighSpeedImpact + minimumSpeed: 0.1 + damage: + types: + Blunt: 1 + - type: Damageable + damageContainer: Biological + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 1 + behaviors: + - !type:PlaySoundBehavior + sound: + collection: desecration + - !type:SpillBehavior + solution: food + - !type:SpawnEntitiesBehavior + spawn: + Eggshells: + min: 1 + max: 1 + # Wow double-yolk you're so lucky! + - !type:DoActsBehavior + acts: [ "Destruction" ] + - type: PointLight + radius: 1.5 + energy: 3 + color: "#4faffb" + +- type: entity + parent: FoodEggBaseVampire + id: FoodEggSpiderVampire + name: Яйцо паука + suffix: Vampire + components: + - type: Sprite + sprite: Backmen/Objects/Misc/eggspider.rsi + layers: + - state: icon + map: [ "enum.DamageStateVisualLayers.Base" ] + - type: PointLight + radius: 1.5 + energy: 3 + color: "#4faffb" + diff --git a/Resources/Prototypes/Backmen/tags.yml b/Resources/Prototypes/Backmen/tags.yml index a4b74633d6d..b79a04bf83e 100644 --- a/Resources/Prototypes/Backmen/tags.yml +++ b/Resources/Prototypes/Backmen/tags.yml @@ -94,3 +94,9 @@ - type: Tag id: MagazinePistolTopSubMachineGun +- type: Tag + id: EggVampire + +- type: Tag + id: MeatVampire + diff --git a/Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/blue-inhand-left.png b/Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/blue-inhand-left.png new file mode 100644 index 0000000000000000000000000000000000000000..491da8592d18f2e5be940387aaae0202c3fa3ee2 GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|3O!vMLn`LH zz2(T;;K0LjfLXp~LIG1jgMi3GF3yO?>yiy}3s3em_+DPJK2H;fl(-{~V Zp66|iRk7U0apojQm8Ywp%Q~loCICLlKa~Ig literal 0 HcmV?d00001 diff --git a/Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/blue-inhand-right.png b/Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/blue-inhand-right.png new file mode 100644 index 0000000000000000000000000000000000000000..85f0f66e700e2464139f1cae917307772bf23e4b GIT binary patch literal 189 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|$~|2iLn`LH zy>(j9A%KT9;7j6S7S=N?Bd`osHXXNbd= i{f*Hs_v{!L>dlyEZdbANp2?FBQs?RF=d#Wzp$P!XAw%f^ literal 0 HcmV?d00001 diff --git a/Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/eggshells.png b/Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/eggshells.png new file mode 100644 index 0000000000000000000000000000000000000000..b6a21f53ce0b9e55368f286053a910f90e31635f GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|Sb)6z%Kv92B z7sn8b-nadRdn8TC0vqOBJ6%3syyW-v%{*TZGj@n!(f6&t;ucLK6Th CPx$07*naR9J=W(;-VkQ5eSYzcS-k*owgehZD!bU0SjjHV{96V9;=bUto2t`V~&l zwhu523m1mzrfV2WqQW(Z;DQ((9Mcu+c^$&w{iRdR^FF+s14=2Sw%MRD4}-=${3T;o zdhyJZ!8(I=hRNtlTw+H$yxv;#{8$2Do#F80fYb3_bYAoZ68z6_>kMxn59CG0-SmY7 zAH9j_0&UZ0vGQ1F_N zjc=&8*5pM-r|2|kLrPL;U Y10yq0@@zB4@c;k-07*qoM6N<$g35l51poj5 literal 0 HcmV?d00001 diff --git a/Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/meta.json b/Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/meta.json new file mode 100644 index 00000000000..11bcbcad54b --- /dev/null +++ b/Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/meta.json @@ -0,0 +1,22 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Made by Nimfar11 (github) for SS14", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "blue-inhand-right", + "directions": 4 + }, + { + "name": "blue-inhand-left", + "directions": 4 + } + ] +} From 50b968a6b7d8f2efc73f2709e871a1c12e9a3c1d Mon Sep 17 00:00:00 2001 From: Kayzel Date: Tue, 7 Nov 2023 22:59:51 +0300 Subject: [PATCH 2/5] fixes --- .../Spider/Components/SpiderVampireComponent.cs | 4 ++-- .../Backmen/Entities/Mobs/NPC/animals.yml | 15 --------------- .../Backmen/Entities/Mobs/NPC/mutants.yml | 4 ++-- .../Entities/Objects/Consumable/Food/egg.yml | 15 ++++++++++++--- 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs b/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs index 13e46dcadf7..32e89544d98 100644 --- a/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs +++ b/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs @@ -14,8 +14,8 @@ public sealed partial class SpiderVampireComponent : Component [DataField] public float UsingEggTime = 20; - [DataField] - public EntProtoId SpawnEgg = default!; + [DataField("spawnEgg")] + public EntProtoId SpawnEgg = "FoodEggSpiderVampire"; /// /// How much hunger is consumed when an entity diff --git a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/animals.yml b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/animals.yml index 4fcef27cdda..e69de29bb2d 100644 --- a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/animals.yml +++ b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/animals.yml @@ -1,15 +0,0 @@ -- type: entity - id: FoodEggSpiderFertilizedVampire - parent: FoodEggSpiderVampire - suffix: Оплодотворенный, Вампир - components: - - type: Timer - - type: TimedSpawner - prototypes: - - MobGiantSpiderVampireAngry - intervalSeconds: 10 - minimumEntitiesSpawned: 1 - maximumEntitiesSpawned: 1 - - type: TimedDespawn - lifetime: 11 - diff --git a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml index cdc260615bc..96ea64a8565 100644 --- a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml +++ b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml @@ -188,8 +188,8 @@ whitelist: tags: - ArachneWeb - - type: SpiderVampire - spawnEgg: FoodEggSpiderFertilizedVampire + - type: SpiderVampire + spawnEgg: FoodEggSpiderVampire - type: entity name: Чёрная вдова diff --git a/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml b/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml index c120299b36b..a1374bd3785 100644 --- a/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml +++ b/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml @@ -56,13 +56,13 @@ - type: PointLight radius: 1.5 energy: 3 - color: "#4faffb" + color: "#4faffb" - type: entity parent: FoodEggBaseVampire id: FoodEggSpiderVampire name: Яйцо паука - suffix: Vampire + suffix: Vampire components: - type: Sprite sprite: Backmen/Objects/Misc/eggspider.rsi @@ -72,5 +72,14 @@ - type: PointLight radius: 1.5 energy: 3 - color: "#4faffb" + color: "#4faffb" + - type: Timer + - type: TimedSpawner + prototypes: + - MobGiantSpiderVampireAngry + intervalSeconds: 10 + minimumEntitiesSpawned: 1 + maximumEntitiesSpawned: 1 + - type: TimedDespawn + lifetime: 11 From 6edd4c71a1847e9ed60beaeb4a100b45e59814ec Mon Sep 17 00:00:00 2001 From: Kayzel Date: Tue, 7 Nov 2023 23:32:02 +0300 Subject: [PATCH 3/5] final fixes --- .../Psionics/Abilities/MindSwapPowerSystem.cs | 4 +- .../Backmen/Spider/SpiderVampireSystem.cs | 56 +++++++++++++------ .../Components/SpiderVampireComponent.cs | 7 +++ .../Backmen/Entities/Mobs/NPC/mutants.yml | 3 + .../Entities/Objects/Consumable/Food/egg.yml | 4 -- .../Entities/Objects/Weapons/Melee/sword.yml | 2 +- Resources/Prototypes/Backmen/tags.yml | 5 -- 7 files changed, 52 insertions(+), 29 deletions(-) diff --git a/Content.Server/Backmen/Abilities/Psionics/Abilities/MindSwapPowerSystem.cs b/Content.Server/Backmen/Abilities/Psionics/Abilities/MindSwapPowerSystem.cs index 74611ebf54c..b351c284270 100644 --- a/Content.Server/Backmen/Abilities/Psionics/Abilities/MindSwapPowerSystem.cs +++ b/Content.Server/Backmen/Abilities/Psionics/Abilities/MindSwapPowerSystem.cs @@ -60,11 +60,11 @@ private void OnInit(EntityUid uid, MindSwapPowerComponent component, ComponentIn _actions.AddAction(uid, ref component.MindSwapPowerAction, ActionMindSwap); -#if !DEBUG + #if !DEBUG if (_actions.TryGetActionData(component.MindSwapPowerAction, out var action) && action?.UseDelay != null) _actions.SetCooldown(component.MindSwapPowerAction, _gameTiming.CurTime, _gameTiming.CurTime + (TimeSpan) action?.UseDelay!); -#endif + #endif if (TryComp(uid, out var psionic) && psionic.PsionicAbility == null) psionic.PsionicAbility = component.MindSwapPowerAction; diff --git a/Content.Server/Backmen/Spider/SpiderVampireSystem.cs b/Content.Server/Backmen/Spider/SpiderVampireSystem.cs index 7cc3d67a622..a0973e632bf 100644 --- a/Content.Server/Backmen/Spider/SpiderVampireSystem.cs +++ b/Content.Server/Backmen/Spider/SpiderVampireSystem.cs @@ -14,11 +14,10 @@ using Robust.Shared.Player; using Content.Shared.Database; using Content.Shared.IdentityManagement; +using Robust.Shared.Timing; namespace Content.Server.Backmen.Spider; - - public sealed class SpiderVampireSystem : EntitySystem { [Dependency] private readonly ActionsSystem _action = default!; @@ -29,6 +28,7 @@ public sealed class SpiderVampireSystem : EntitySystem [Dependency] private readonly HungerSystem _hunger = default!; [Dependency] private readonly IAdminLogManager _adminLog = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; public override void Initialize() { @@ -40,18 +40,25 @@ public override void Initialize() SubscribeLocalEvent(OnMapInit); } -#region Добавить скилл + #region Добавить скилл [ValidatePrototypeId] private const string SpiderVampireEggAction = "ActionSpiderVampireEgg"; private void OnMapInit(EntityUid uid, SpiderVampireComponent component, MapInitEvent args) { _action.AddAction(uid, ref component.SpiderVampireEggAction, SpiderVampireEggAction); + _action.SetCooldown(component.SpiderVampireEggAction, _gameTiming.CurTime, + _gameTiming.CurTime + (TimeSpan) component.InitCooldown); + _action.SetCharges(component.SpiderVampireEggAction, component.Charges); } -#endregion -#region Нажали на кнопку - private static readonly SoundSpecifier HairballPlay = new SoundPathSpecifier("/Audio/Backmen/Effects/Species/hairball.ogg", AudioParams.Default.WithVariation(0.15f)); + #endregion + + #region Нажали на кнопку + + private static readonly SoundSpecifier HairballPlay = + new SoundPathSpecifier("/Audio/Backmen/Effects/Species/hairball.ogg", AudioParams.Default.WithVariation(0.15f)); + private void OnActionEggUsed(EntityUid uid, SpiderVampireComponent component, SpiderVampireEggActionEvent args) { if (args.Handled) @@ -81,30 +88,45 @@ private void OnActionEggUsed(EntityUid uid, SpiderVampireComponent component, Sp return; } - _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, uid, component.UsingEggTime, new SpiderVampireEggDoAfterEvent(), uid, used: uid) + _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, uid, component.UsingEggTime, + new SpiderVampireEggDoAfterEvent(), uid, used: uid) { - BreakOnTargetMove = true, BreakOnUserMove = true, BreakOnDamage = true, }); - _audio.Play(HairballPlay, Filter.Pvs(uid, entityManager: EntityManager), Transform(uid).Coordinates, true, AudioParams.Default.WithVariation(0.025f)); + _audio.Play(HairballPlay, Filter.Pvs(uid, entityManager: EntityManager), Transform(uid).Coordinates, true, + AudioParams.Default.WithVariation(0.025f)); args.Handled = true; } -#endregion -#region После каста - private void OnActionEggUsedAfter(EntityUid uid, SpiderVampireComponent component, SpiderVampireEggDoAfterEvent args) + #endregion + + #region После каста + + private void OnActionEggUsedAfter(EntityUid uid, SpiderVampireComponent component, + SpiderVampireEggDoAfterEvent args) { - if (args.Handled || args.Cancelled) + if (args.Handled) return; + if (args.Cancelled) + { + if (_action.TryGetActionData(component.SpiderVampireEggAction, out var data)) + { + _action.SetCharges(component.SpiderVampireEggAction, data.Charges+1); + _action.SetCooldown(component.SpiderVampireEggAction, _gameTiming.CurTime, + _gameTiming.CurTime); + } + return; + } + var xform = Transform(uid); var offspring = Spawn(component.SpawnEgg, xform.Coordinates.Offset(_random.NextVector2(0.3f))); _hunger.ModifyHunger(uid, -component.HungerPerBirth); _adminLog.Add(LogType.Action, $"{ToPrettyString(uid)} gave birth to {ToPrettyString(offspring)}."); - _popupSystem.PopupEntity(Loc.GetString("reproductive-birth-popup", ("parent", Identity.Entity(uid, EntityManager))), uid); + _popupSystem.PopupEntity( + Loc.GetString("reproductive-birth-popup", ("parent", Identity.Entity(uid, EntityManager))), uid); } -#endregion -} - + #endregion +} diff --git a/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs b/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs index 32e89544d98..924a7482c9b 100644 --- a/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs +++ b/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs @@ -1,6 +1,7 @@ using Robust.Shared.GameStates; using Content.Shared.DoAfter; +using Content.Shared.FixedPoint; using Robust.Shared.Serialization; using Robust.Shared.Prototypes; @@ -14,6 +15,12 @@ public sealed partial class SpiderVampireComponent : Component [DataField] public float UsingEggTime = 20; + [DataField("charges")] + public int Charges = 1; + + [DataField] + public TimeSpan InitCooldown = TimeSpan.FromMinutes(5); + [DataField("spawnEgg")] public EntProtoId SpawnEgg = "FoodEggSpiderVampire"; diff --git a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml index 96ea64a8565..6f5816e2a38 100644 --- a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml +++ b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml @@ -396,3 +396,6 @@ description: ghost-role-information-giant-spider-vampire-description rules: No antagonist restrictions. Just don't talk in emote; you have telepathic chat. - type: GhostTakeoverAvailable + - type: SpiderVampire + spawnEgg: FoodEggSpiderVampire + charges: 10 diff --git a/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml b/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml index a1374bd3785..b3f712fdcf8 100644 --- a/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml +++ b/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml @@ -4,10 +4,6 @@ description: An egg! abstract: true components: - - type: Tag - tags: - - EggVampire - - MeatVampire - type: Food trash: Eggshells - type: Sprite diff --git a/Resources/Prototypes/Backmen/Entities/Objects/Weapons/Melee/sword.yml b/Resources/Prototypes/Backmen/Entities/Objects/Weapons/Melee/sword.yml index 07213c314fb..6887de50d0b 100644 --- a/Resources/Prototypes/Backmen/Entities/Objects/Weapons/Melee/sword.yml +++ b/Resources/Prototypes/Backmen/Entities/Objects/Weapons/Melee/sword.yml @@ -1,5 +1,5 @@ - type: entity - name: Saber of the Leader of the Red Order + name: Saber of the Leader of the Red Orden parent: BaseItem id: OrdenSabre description: Unusual saber. Instead of a blade, this weapon uses the teeth of a space dragon, which cut and cling to the victim's flesh, tearing open wounds. Nightmare weapon. diff --git a/Resources/Prototypes/Backmen/tags.yml b/Resources/Prototypes/Backmen/tags.yml index b79a04bf83e..98779ddb520 100644 --- a/Resources/Prototypes/Backmen/tags.yml +++ b/Resources/Prototypes/Backmen/tags.yml @@ -94,9 +94,4 @@ - type: Tag id: MagazinePistolTopSubMachineGun -- type: Tag - id: EggVampire - -- type: Tag - id: MeatVampire From 3fd9f3b9b1cdc397595023f93b8f76a1065d8bd7 Mon Sep 17 00:00:00 2001 From: Kayzel Date: Tue, 7 Nov 2023 23:38:01 +0300 Subject: [PATCH 4/5] Update SpiderVampireSystem.cs --- Content.Server/Backmen/Spider/SpiderVampireSystem.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Content.Server/Backmen/Spider/SpiderVampireSystem.cs b/Content.Server/Backmen/Spider/SpiderVampireSystem.cs index a0973e632bf..8065400eb39 100644 --- a/Content.Server/Backmen/Spider/SpiderVampireSystem.cs +++ b/Content.Server/Backmen/Spider/SpiderVampireSystem.cs @@ -47,8 +47,8 @@ public override void Initialize() private void OnMapInit(EntityUid uid, SpiderVampireComponent component, MapInitEvent args) { _action.AddAction(uid, ref component.SpiderVampireEggAction, SpiderVampireEggAction); - _action.SetCooldown(component.SpiderVampireEggAction, _gameTiming.CurTime, - _gameTiming.CurTime + (TimeSpan) component.InitCooldown); + //_action.SetCooldown(component.SpiderVampireEggAction, _gameTiming.CurTime, + // _gameTiming.CurTime + (TimeSpan) component.InitCooldown); _action.SetCharges(component.SpiderVampireEggAction, component.Charges); } @@ -115,7 +115,8 @@ private void OnActionEggUsedAfter(EntityUid uid, SpiderVampireComponent componen { _action.SetCharges(component.SpiderVampireEggAction, data.Charges+1); _action.SetCooldown(component.SpiderVampireEggAction, _gameTiming.CurTime, - _gameTiming.CurTime); + _gameTiming.CurTime + TimeSpan.FromSeconds(1)); + _action.SetEnabled(component.SpiderVampireEggAction, true); } return; } From de15449a69f887f7511445325f05a9763c599aa6 Mon Sep 17 00:00:00 2001 From: Cvasic Date: Thu, 9 Nov 2023 15:22:00 +0400 Subject: [PATCH 5/5] fix --- .../ru-RU/ss14-ru/prototypes/backmen/actions/arachne.ftl | 2 ++ Resources/Prototypes/Backmen/Actions/arachne.yml | 6 +++--- .../Backmen/Entities/Objects/Consumable/Food/egg.yml | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Resources/Locale/ru-RU/ss14-ru/prototypes/backmen/actions/arachne.ftl b/Resources/Locale/ru-RU/ss14-ru/prototypes/backmen/actions/arachne.ftl index 4903efcf22a..33ade53ff22 100644 --- a/Resources/Locale/ru-RU/ss14-ru/prototypes/backmen/actions/arachne.ftl +++ b/Resources/Locale/ru-RU/ss14-ru/prototypes/backmen/actions/arachne.ftl @@ -1,2 +1,4 @@ ent-SpiderWebArachneClassicAction = Сплести паутину .desc = Вы сплетаете паутину под собой. +ent-ActionSpiderVampireEgg = Снести яйцо + .desc = Снесите яйцо для продолжения потомства diff --git a/Resources/Prototypes/Backmen/Actions/arachne.yml b/Resources/Prototypes/Backmen/Actions/arachne.yml index b00468d8402..5af0325568d 100644 --- a/Resources/Prototypes/Backmen/Actions/arachne.yml +++ b/Resources/Prototypes/Backmen/Actions/arachne.yml @@ -8,11 +8,11 @@ useDelay: 180 icon: Interface/Actions/web.png event: !type:SpiderWebActionEvent - + - type: entity id: ActionSpiderVampireEgg - name: name Spider Vampire Egg - description: description Spider Vampire Egg + name: name-Spider-Vampire-Egg + description: description-Spider-Vampire-Egg noSpawn: true components: - type: InstantAction diff --git a/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml b/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml index a1374bd3785..cda961c703e 100644 --- a/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml +++ b/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml @@ -77,9 +77,9 @@ - type: TimedSpawner prototypes: - MobGiantSpiderVampireAngry - intervalSeconds: 10 + intervalSeconds: 300 minimumEntitiesSpawned: 1 maximumEntitiesSpawned: 1 - type: TimedDespawn - lifetime: 11 + lifetime: 301