Skip to content

Commit

Permalink
фикс 12
Browse files Browse the repository at this point in the history
  • Loading branch information
BL02DL committed Dec 21, 2024
1 parent 8f8d1e9 commit 699c55a
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 18 deletions.
48 changes: 46 additions & 2 deletions Content.Server/Weapons/Ranged/Systems/GunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid?
case CartridgeAmmoComponent cartridge:
if (!cartridge.Spent)
{

/// Start _LostParadise

var uid = Spawn(cartridge.Prototype, fromEnt);
CreateAndFireProjectiles(uid, cartridge);

/// End _LostParadise

if (cartridge.Count > 1)
{
var ev = new GunGetAmmoSpreadEvent(cartridge.Spread);
Expand All @@ -138,14 +146,12 @@ public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid?

for (var i = 0; i < cartridge.Count; i++)
{
var uid = Spawn(cartridge.Prototype, fromEnt);
ShootOrThrow(uid, angles[i].ToVec(), gunVelocity, gun, gunUid, user);
shotProjectiles.Add(uid);
}
}
else
{
var uid = Spawn(cartridge.Prototype, fromEnt);
ShootOrThrow(uid, mapDirection, gunVelocity, gun, gunUid, user);
shotProjectiles.Add(uid);
}
Expand Down Expand Up @@ -176,6 +182,9 @@ public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid?
break;
// Ammo shoots itself
case AmmoComponent newAmmo:
if (ent == null)
break;
CreateAndFireProjectiles(ent.Value, newAmmo);
shotProjectiles.Add(ent!.Value);
MuzzleFlash(gunUid, newAmmo, mapDirection.ToAngle(), user);
Audio.PlayPredicted(gun.SoundGunshotModified, gunUid, user);
Expand Down Expand Up @@ -276,6 +285,41 @@ public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid?
{
FiredProjectiles = shotProjectiles,
});

/// Start _LostParadise

void CreateAndFireProjectiles(EntityUid ammoEnt, AmmoComponent ammoComp)
{
if (TryComp<ProjectileSpreadComponent>(ammoEnt, out var ammoSpreadComp))
{
var spreadEvent = new GunGetAmmoSpreadEvent(ammoSpreadComp.Spread);
RaiseLocalEvent(gunUid, ref spreadEvent);

var angles = LinearSpread(mapAngle - spreadEvent.Spread / 2,
mapAngle + spreadEvent.Spread / 2, ammoSpreadComp.Count);

ShootOrThrow(ammoEnt, angles[0].ToVec(), gunVelocity, gun, gunUid, user);
shotProjectiles.Add(ammoEnt);

for (var i = 1; i < ammoSpreadComp.Count; i++)
{
var newuid = Spawn(ammoSpreadComp.Proto, fromEnt);
ShootOrThrow(newuid, angles[i].ToVec(), gunVelocity, gun, gunUid, user);
shotProjectiles.Add(newuid);
}
}
else
{
ShootOrThrow(ammoEnt, mapDirection, gunVelocity, gun, gunUid, user);
shotProjectiles.Add(ammoEnt);
}

MuzzleFlash(gunUid, ammoComp, mapDirection.ToAngle(), user);
Audio.PlayPredicted(gun.SoundGunshotModified, gunUid, user);
}

/// End _LostParadise

}

private void ShootOrThrow(EntityUid uid, Vector2 mapDirection, Vector2 gunVelocity, GunComponent gun, EntityUid gunUid, EntityUid? user)
Expand Down
32 changes: 32 additions & 0 deletions Content.Shared/Projectiles/ProjectileSpreadComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;

namespace Content.Shared.Projectiles;

/// <summary>
/// Spawns a spread of the projectiles when fired
/// </summary>
[RegisterComponent, NetworkedComponent, Access(typeof(SharedGunSystem))]
public sealed partial class ProjectileSpreadComponent : Component
{
/// <summary>
/// The entity prototype that will be fired by the rest of the spread.
/// Will generally be the same entity prototype as the first projectile being fired.
/// Needed for ammo components that do not specify a fired prototype, unlike cartridges.
/// </summary>
[DataField(required: true)]
public EntProtoId Proto;

/// <summary>
/// How much the ammo spreads when shot, in degrees. Does nothing if count is 0.
/// </summary>
[DataField]
public Angle Spread = Angle.FromDegrees(5);

/// <summary>
/// How many prototypes are spawned when shot.
/// </summary>
[DataField]
public int Count = 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@

# Humans
# Blood Cult Priest, ranged mab, bolts deal 10 slash damage
# Look for magic bolt here:\Resources\Prototypes\_NF\Entities\Objects\Weapons\Guns\Projectiles\magic.yml
- type: entity
name: blood cult priest
parent:
- MobBloodCultistBase
- MobHumanoidHostileAISimpleRanged
#- MobLaserReflect # Added to prevent laser abuse from players
id: MobBloodCultistPriest
description: Enlightened by the whispers of The Void That Is, these individuals are initiated into secret rituals. They lead the blood harvest and perform rites, bringing the day when Nar'Sie rises ever closer.
categories: [ HideSpawnMenu ]
Expand Down Expand Up @@ -57,13 +55,11 @@
path: /Audio/Effects/Lightning/lightningshock.ogg

# Blood Cult Janitor, ranged mab, bolts deal 10 slash damage
# Look for magic bolt here:\Resources\Prototypes\_NF\Entities\Objects\Weapons\Guns\Projectiles\magic.yml
- type: entity
name: blood cult janitor
parent:
- MobBloodCultistBase
- MobHumanoidHostileAISimpleRanged
#- MobLaserReflect # Added to prevent laser abuse from players
id: MobBloodCultistJanitor
description: The fate of blood cults on space stations hinges on the actions of a single individual - the station janitor. This humble worker serves as the primary line of defense against the presence of blood cults, but even the most resolute individuals can be swayed by corruption.
categories: [ HideSpawnMenu ]
Expand Down Expand Up @@ -98,7 +94,6 @@
parent:
- MobBloodCultistBase
- MobHumanoidHostileAISimpleMelee
#- MobLaserReflect # Added to prevent laser abuse from players
id: MobBloodCultistAcolyte
description: |-
The acolyte - The most trusted cult follower and bodyguard of a priest, clad in the finest armor the cult has to offer and armed with the most vile weapons: eldrich blades and unholy halberds.
Expand All @@ -123,7 +118,6 @@
- BloodCultistZealotMeleeGear

# Blood Cult Zealot, ranged mob, crossbow bolt deals 20 slash and 5 bloodloss
# Look for crossbow bolt here: \Resources\Prototypes\_NF\Entities\Objects\Weapons\Guns\Projectiles\crossbow_bolts.yml
- type: entity
name: blood cult zealot
parent:
Expand Down Expand Up @@ -155,7 +149,6 @@
collection: BulletMiss

# Blood Cult Zealot, ranged mob, magic bolt deals 5 slash and 2 bloodloss
# Look for magic bolt here:\Resources\Prototypes\_LostParadise\Entities\Objects\Weapons\Guns\Projectiles\magic.yml
- type: entity
name: blood cult zealot
parent:
Expand Down Expand Up @@ -470,7 +463,6 @@

# Turrets
# blood pylon, ranged, magic bolt deals 5 slash and 2 bloodloss
# Look for magic bolt here:\Resources\Prototypes\_NF\Entities\Objects\Weapons\Guns\Projectiles\magic.yml
- type: entity
parent:
- BaseWeaponTurret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
path: /Audio/_LostParadise/Effects/silence.ogg

# Red Wizard, shoots magic bolts that put targets on fire (2 heat damage, 2 fire stacks)
# Look for magic bolt here:\Resources\Prototypes\_NF\Entities\Objects\Weapons\Guns\Projectiles\magic.yml
- type: entity
name: Red Wizard
parent: MobWizFedlBase
Expand All @@ -89,7 +88,6 @@
path: /Audio/Magic/fireball.ogg

# Violet Wizard, shoots asphyxiation magic bolts (4 bloodloss, 4 asphyxiation)
# Look for magic bolt here:\Resources\Prototypes\_NF\Entities\Objects\Weapons\Guns\Projectiles\magic.yml
- type: entity
name: Violet Wizard
parent: MobWizFedlBase
Expand All @@ -114,7 +112,6 @@
path: /Audio/_LostParadise/Effects/silence.ogg

# Soap Wizard, summons soap to slip targets
# Look for soap here: \Resources\Prototypes\_NF\Entities\Objects\Specific\Wizard\conjured_items.yml
- type: entity
name: Soap Wizard
parent: MobWizFedlBase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- type: entity
id: BaseCrossbow
name: crossbow
parent: [ BaseItem, GunMeleeAttackBluntBase ] # \Resources\Prototypes\_NF\Entities\Objects\Weapons\Melee\base_melee_weapon.yml
parent: [ BaseItem, GunMeleeAttackBluntBase ]
description: The original rooty tooty point and shooty.
abstract: true
components:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- type: EmbeddableProjectile
offset: -0.15,0.0
- type: Sprite
sprite: _NF/Mobs/Aliens/flesh.rsi
sprite: _LostParadise/Mobs/Aliens/flesh.rsi
layers:
- state: spike
- state: spikeSolution1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Base
# Localisation file \Resources\Locale\en-US\_NF\structure\weapon-racks.ftl
- type: entity
id: StructureWeaponRackBase
name: weapon rack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@
# - type: entity
# parent:
# - VendingMachine
# - PunkHoloGraffitiOverlay # Prototype can be located at \Resources\Prototypes\_NF\Entities\Structures\Holographic\graffiti.yml
# - PunkHoloGraffitiOverlay
# id: VendingMachineClothingPunk
# name: ThreadsChoom
# description: A vandalized ClothesMate.
Expand Down Expand Up @@ -833,7 +833,7 @@
# - type: entity
# parent:
# - VendingMachine
# - PunkHoloGraffitiOverlay # Prototype can be located at \Resources\Prototypes\_NF\Entities\Structures\Holographic\graffiti.yml
# - PunkHoloGraffitiOverlay
# id: VendingMachineBountyVendPunk
# name: BonanzaMatic
# description: A vandalised BountyVend.
Expand Down

0 comments on commit 699c55a

Please sign in to comment.