From b0bbf5df351fbace50b74e0aec14f7611ec017cd Mon Sep 17 00:00:00 2001 From: Cvasic <141816796+Cvasic@users.noreply.github.com> Date: Fri, 10 Nov 2023 16:09:02 +0400 Subject: [PATCH] Egg Spider (#301) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * да * fixes * final fixes * Update SpiderVampireSystem.cs * fix --------- Co-authored-by: Kayzel --- .../Psionics/Abilities/MindSwapPowerSystem.cs | 4 +- .../Backmen/Spider/SpiderVampireSystem.cs | 133 ++++++++++++++++++ .../IgnoreSpiderWebArachneClassicComponent.cs | 2 +- .../Components/SpiderVampireComponent.cs | 39 +++++ .../Components/SpiderVampireEggActionEvent.cs | 5 + .../prototypes/backmen/actions/arachne.ftl | 2 + .../Prototypes/Backmen/Actions/arachne.yml | 13 ++ .../Backmen/Entities/Mobs/NPC/animals.yml | 0 .../Backmen/Entities/Mobs/NPC/mutants.yml | 5 + .../Entities/Objects/Consumable/Food/egg.yml | 81 +++++++++++ .../Entities/Objects/Weapons/Melee/sword.yml | 2 +- Resources/Prototypes/Backmen/tags.yml | 1 + .../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 +++ 17 files changed, 305 insertions(+), 4 deletions(-) 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/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 new file mode 100644 index 00000000000..8065400eb39 --- /dev/null +++ b/Content.Server/Backmen/Spider/SpiderVampireSystem.cs @@ -0,0 +1,133 @@ +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; +using Robust.Shared.Timing; + +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!; + [Dependency] private readonly IGameTiming _gameTiming = 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); + //_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)); + + 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) + { + 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) + 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 + TimeSpan.FromSeconds(1)); + _action.SetEnabled(component.SpiderVampireEggAction, true); + } + 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..924a7482c9b --- /dev/null +++ b/Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs @@ -0,0 +1,39 @@ + +using Robust.Shared.GameStates; +using Content.Shared.DoAfter; +using Content.Shared.FixedPoint; +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("charges")] + public int Charges = 1; + + [DataField] + public TimeSpan InitCooldown = TimeSpan.FromMinutes(5); + + [DataField("spawnEgg")] + public EntProtoId SpawnEgg = "FoodEggSpiderVampire"; + + /// + /// 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/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 acc29177be5..5af0325568d 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..e69de29bb2d diff --git a/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml b/Resources/Prototypes/Backmen/Entities/Mobs/NPC/mutants.yml index 6acd894d33f..ead4338c0ee 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: FoodEggSpiderVampire - type: entity name: Чёрная вдова @@ -394,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 new file mode 100644 index 00000000000..fd83f4a3076 --- /dev/null +++ b/Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml @@ -0,0 +1,81 @@ +- type: entity + parent: [FoodInjectableBase, ItemHeftyBase] + id: FoodEggBaseVampire + description: An egg! + abstract: true + components: + - 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" + - type: Timer + - type: TimedSpawner + prototypes: + - MobGiantSpiderVampireAngry + intervalSeconds: 300 + minimumEntitiesSpawned: 1 + maximumEntitiesSpawned: 1 + - type: TimedDespawn + lifetime: 301 + 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 a4b74633d6d..98779ddb520 100644 --- a/Resources/Prototypes/Backmen/tags.yml +++ b/Resources/Prototypes/Backmen/tags.yml @@ -94,3 +94,4 @@ - type: Tag id: MagazinePistolTopSubMachineGun + 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 + } + ] +}