-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* да * fixes * final fixes * Update SpiderVampireSystem.cs * fix --------- Co-authored-by: Kayzel <[email protected]>
- Loading branch information
Showing
17 changed files
with
305 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<SpiderVampireComponent, SpiderVampireEggActionEvent>(OnActionEggUsed); | ||
SubscribeLocalEvent<SpiderVampireComponent, SpiderVampireEggDoAfterEvent>(OnActionEggUsedAfter); | ||
|
||
SubscribeLocalEvent<SpiderVampireComponent, MapInitEvent>(OnMapInit); | ||
} | ||
|
||
#region Добавить скилл | ||
|
||
[ValidatePrototypeId<EntityPrototype>] 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<InfantComponent>(uid)) | ||
{ | ||
_popupSystem.PopupEntity("Еще не дорос", uid, uid); | ||
return; | ||
} | ||
|
||
if (_mobState.IsIncapacitated(uid)) | ||
{ | ||
_popupSystem.PopupEntity("хуйня какая-то", uid, uid); | ||
return; | ||
} | ||
|
||
if (TryComp<HungerComponent>(uid, out var hunger) && _hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay) | ||
{ | ||
_popupSystem.PopupEntity("жрать хочу", uid, uid); | ||
return; | ||
} | ||
|
||
if (TryComp<ThirstComponent>(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 | ||
} |
2 changes: 1 addition & 1 deletion
2
...IgnoreSpiderWebArachneClassicComponent.cs → ...IgnoreSpiderWebArachneClassicComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
Content.Shared/Backmen/Spider/Components/SpiderVampireComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
|
||
/// <summary> | ||
/// How much hunger is consumed when an entity | ||
/// gives birth. A balancing tool to require feeding. | ||
/// </summary> | ||
[DataField, ViewVariables(VVAccess.ReadWrite)] | ||
public float HungerPerBirth = 75f; | ||
} | ||
|
||
[Serializable, NetSerializable] | ||
public sealed partial class SpiderVampireEggDoAfterEvent : SimpleDoAfterEvent | ||
{ | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
Content.Shared/Backmen/Spider/Components/SpiderVampireEggActionEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using Content.Shared.Actions; | ||
|
||
namespace Content.Shared.Backmen.Spider.Components; | ||
|
||
public sealed partial class SpiderVampireEggActionEvent : InstantActionEvent {} |
2 changes: 2 additions & 0 deletions
2
Resources/Locale/ru-RU/ss14-ru/prototypes/backmen/actions/arachne.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
ent-SpiderWebArachneClassicAction = Сплести паутину | ||
.desc = Вы сплетаете паутину под собой. | ||
ent-ActionSpiderVampireEgg = Снести яйцо | ||
.desc = Снесите яйцо для продолжения потомства |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
Resources/Prototypes/Backmen/Entities/Objects/Consumable/Food/egg.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
2 changes: 1 addition & 1 deletion
2
Resources/Prototypes/Backmen/Entities/Objects/Weapons/Melee/sword.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,3 +94,4 @@ | |
- type: Tag | ||
id: MagazinePistolTopSubMachineGun | ||
|
||
|
Binary file added
BIN
+183 Bytes
Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/blue-inhand-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+189 Bytes
Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/blue-inhand-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+213 Bytes
Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/eggshells.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
Resources/Textures/Backmen/Objects/Misc/eggspider.rsi/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
] | ||
} |