mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 08:37:26 +00:00
* 1 * 2 * remove dismantle testing changes * add ammount handling, and add random angle * code-side things * code-side things * code-side things * 3 * 4 * 5 * 6 * changed description for now * whoops * 7 * 8 * 9 * Texture fix * Tada! I diiid iiitttt * Delete .icon.png-autosave.kra * 10 * test another * 11 * Localization fixes 2 Also some minor rebalancing of armor/shield/helmet crafting * ROOOUND 33333 * test wawa * wiz * fixes * MORE FIXES * MORE MORE FIXES * Smg mag fix * Why does it have reflet Removed reflect chance and made the damage the same as a plasteel arming sword * belt fix * phosphorus addition * improvised round bulk crafting * Update tags * tags update 2 * Update tags.yml * fix tags AGAIN * TAG FIX AGAIN * Fixed the sound path * Fixed missing components hopefully * fix it hopefully * Update tidebreaker.yml * fixed errors * fixed? * Update shields.yml * Update tools.yml * Fixes * Update tools.yml * Update tools.yml * Update tools.yml * Update tools.yml * Update tools.yml * screwdriver fix 200 * Update tools.yml * Update tools.yml * Apply suggestions from code review Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update SharedItemSwitchSystem.cs * review changes * Fix server and client files * Namespace fixes. * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/Entities/Objects/Tools/crowbars.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/Entities/Objects/Tools/tools.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/Entities/Objects/Tools/tools.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/Entities/Objects/Tools/tools.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/Entities/Objects/Tools/tools.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/Entities/Clothing/Belt/belts.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/Recipes/Crafting/Graphs/improvised/improvised_omnitool.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/Recipes/Crafting/Graphs/improvised/improvised_omnitool.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/Recipes/Crafting/Graphs/improvised/improvised_omnitool.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/Recipes/Crafting/Graphs/improvised/improvised_omnitool.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/tags.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/tags.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/tags.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/tags.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/tags.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/tags.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/tags.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/tags.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/tags.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_StarLight/tags.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update SharedWeaponDismantleOnShootSystem.cs * Update Resources/Prototypes/Recipes/Crafting/Graphs/improvised/improvised_shotgun_shell.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> * Update Resources/Prototypes/_DV/Entities/Objects/Weapons/Guns/Ammunition/Boxes/improvised.yml Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> --------- Signed-off-by: Apachito <ivanlopezlegos2004@gmail.com> Co-authored-by: KillerTheFlareon <tyler443344@outlook.com> Co-authored-by: Matthew Herber <matthewherber@sbcglobal.net> Co-authored-by: Athena-AI <AthenaTheAI@outlook.com> Co-authored-by: stickycheZ101 <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> Co-authored-by: stickycheZ101 <96800602+stickycheZ101@users.noreply.github.com> Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Co-authored-by: Vanessa <vanessalouwagie@gmail.com>
102 lines
3.5 KiB
C#
102 lines
3.5 KiB
C#
using System.Numerics;
|
|
using Content.Shared._Starlight.Weapon.Components;
|
|
using Content.Shared.Throwing;
|
|
using Content.Shared.Weapons.Ranged.Events;
|
|
using Content.Shared.Damage;
|
|
using Content.Shared.Damage.Systems;
|
|
using Content.Shared.Weapons.Ranged.Components;
|
|
using Robust.Shared.Random;
|
|
using Robust.Shared.Audio.Systems;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Content.Shared._Starlight.Weapon;
|
|
|
|
public abstract partial class SharedWeaponDismantleOnShootSystem : EntitySystem
|
|
{
|
|
[Dependency] protected readonly ThrowingSystem Throwing = default!;
|
|
[Dependency] protected readonly DamageableSystem Damageable = default!;
|
|
[Dependency] protected readonly SharedAudioSystem Audio = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<WeaponDismantleOnShootComponent, AmmoShotEvent>(OnGunShot);
|
|
}
|
|
|
|
public bool DismantleCheck(Entity<WeaponDismantleOnShootComponent> ent, ref AmmoShotEvent args)
|
|
{
|
|
//roll to see if we explode or not
|
|
var random = IoCManager.Resolve<IRobustRandom>();
|
|
//1.0f means always true, 0.0f means always false
|
|
if (!random.Prob(ent.Comp.DismantleChance))
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
private void OnGunShot(Entity<WeaponDismantleOnShootComponent> ent, ref AmmoShotEvent args)
|
|
{
|
|
if (DismantleCheck(ent, ref args) == false)
|
|
return;
|
|
|
|
// we need the user (shooter) to proceed
|
|
if (!args.Shooter.HasValue)
|
|
return;
|
|
|
|
var shooter = args.Shooter.Value;
|
|
|
|
// apply the damage to the shooter (expects Entity<DamageableComponent?>)
|
|
Damageable.TryChangeDamage((shooter, null), ent.Comp.SelfDamage, origin: shooter);
|
|
|
|
Audio.PlayPredicted(ent.Comp.DismantleSound, shooter, shooter);
|
|
|
|
// get the user's transform
|
|
var userPosition = Transform(shooter).Coordinates;
|
|
|
|
if (!TryComp<GunComponent>(ent, out var gunComponent))
|
|
return;
|
|
|
|
var toCoordinates = gunComponent.ShootCoordinates;
|
|
|
|
if (toCoordinates == null)
|
|
return;
|
|
|
|
//loop through all of the items
|
|
var random = IoCManager.Resolve<IRobustRandom>();
|
|
foreach (var item in ent.Comp.items)
|
|
{
|
|
for (var i = 0; i < item.Amount; i++)
|
|
{
|
|
//roll to see if we destroy the item or not
|
|
if (!random.Prob(item.SpawnProbability))
|
|
continue;
|
|
|
|
//get the item entity
|
|
var itemEntity = Spawn(item.PrototypeId, userPosition);
|
|
|
|
var direction = toCoordinates.Value.Position;
|
|
//normalize it
|
|
direction = Vector2.Normalize(direction);
|
|
//multiply it by the distance
|
|
direction *= ent.Comp.DismantleDistance;
|
|
//rotate it by the angle
|
|
direction = item.LaunchAngle.RotateVec(direction);
|
|
|
|
//roll for random angle modifier
|
|
double randomAngle = random.NextDouble(-item.AngleRandomness.Degrees, item.AngleRandomness.Degrees);
|
|
//rotate it by the random angle
|
|
direction = Angle.FromDegrees(randomAngle).RotateVec(direction);
|
|
|
|
var throwDirection = new EntityCoordinates(shooter, direction);
|
|
|
|
Throwing.TryThrow(itemEntity, throwDirection, ent.Comp.DismantleDistance, compensateFriction: true);
|
|
}
|
|
}
|
|
|
|
//now we need to destroy the gun
|
|
//get the gun entity
|
|
PredictedQueueDel(ent.Owner);
|
|
}
|
|
}
|