Skip to content
This repository was archived by the owner on Jan 20, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
582 changes: 291 additions & 291 deletions .sbproj

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions code/Systems/Weapon/Components/PrimaryFireComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ public partial class PrimaryFire : WeaponComponent, ISingletonComponent
[Net, Prefab, Category( "Bullet" )] public int BulletCount { get; set; }
[Net, Prefab, Category( "Bullet" )] public float BulletForce { get; set; }
[Net, Prefab, Category( "Bullet" )] public float BulletSize { get; set; }
[Net, Prefab, Category( "Bullet" )] public float BulletSpread { get; set; }
[Net, Prefab, Category( "Bullet" )] public float BulletSpread { get; set; }

[Net, Prefab, Category( "Bullet" )] public float AimSpread { get; set; }
[Net, Prefab, Category( "General" )] public float RPM { get; set; }

protected AimDownSights AimData => Weapon.GetComponent<AimDownSights>();
Expand All @@ -40,8 +41,8 @@ public enum Firing_Type

protected override bool CanStart( Pawn player )
{
if ( player.Controller.IsMechanicActive<SprintMechanic>() ) return false;

if ( player.Controller.IsMechanicActive<SprintMechanic>() ) return false;
if ( Weapon.Ammo == 0 ) return false;
if ( CanBurst() )
{
BurstCount = 0;
Expand Down Expand Up @@ -105,7 +106,7 @@ protected override void OnStart( Pawn player )
DoShootEffects( To.Single( player ) );
}

ShootBullet( BulletSpread, BulletForce, BulletSize, BulletCount, BulletRange );
ShootBullet( BulletSpread, AimSpread, BulletForce, BulletSize, BulletCount, BulletRange );
}

[ClientRpc]
Expand Down Expand Up @@ -141,7 +142,7 @@ public virtual IEnumerable<TraceResult> TraceBullet( Vector3 start, Vector3 end,
yield return tr;
}

public virtual void ShootBullet( float spread, float force, float bulletSize, int bulletCount = 1, float bulletRange = 5000f )
public virtual void ShootBullet( float spread, float aimSpread, float force, float bulletSize, int bulletCount = 1, float bulletRange = 5000f )
{
//
// Seed rand using the tick, so bullet cones match on client and server
Expand All @@ -152,8 +153,9 @@ public virtual void ShootBullet( float spread, float force, float bulletSize, in
{
var rot = Rotation.LookAt( Player.AimRay.Forward );

var forward = rot.Forward;
forward += (Vector3.Random + Vector3.Random + Vector3.Random + Vector3.Random) * spread * 0.25f;
var forward = rot.Forward;
float multiplier = Input.Down( "attack2" ) ? aimSpread : spread;
forward += (Vector3.Random + Vector3.Random + Vector3.Random + Vector3.Random) * multiplier * 0.25f;
forward = forward.Normal;

var damage = BaseDamage;
Expand Down
3 changes: 2 additions & 1 deletion code/Systems/Weapon/Components/ReloadComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ protected override bool CanStart( Pawn player )

if ( IsReloading || controller.IsMechanicActive<SprintMechanic>() ) return false;
if ( Weapon.Ammo == Weapon.MaxAmmo || Weapon.ReserveAmmo == 0 ) return false;
if ( Input.Down( "reload" ) ) return true;
if ( Input.Down( "reload" ) ) return true;
if ( Weapon.Ammo == 0 && Input.Released( "attack1" ) ) return true;
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions code/player/Pawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public void Respawn()
Components.Create<MoteBag>();

var inventory = Components.Create<Inventory>();
inventory.AddWeapon( PrefabLibrary.Spawn<Weapon>( "prefabs/pistol.prefab" ) );

inventory.AddWeapon( PrefabLibrary.Spawn<Weapon>( "prefabs/placeholder/pistol.prefab" ) );
inventory.AddWeapon( PrefabLibrary.Spawn<Weapon>( "prefabs/placeholder/mp5.prefab" ) );
GameManager.Current?.MoveToSpawnpoint( this );
Position = Position + Vector3.Up * 2;
ResetInterpolation();
Expand Down
Binary file modified maps/test.vmap
Binary file not shown.
52 changes: 26 additions & 26 deletions maps/test.vmap.meta
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"publish": {
"Allowed": true,
"Enabled": false,
"ProjectConfig": {
"Title": "test",
"Type": "map",
"Org": "local",
"Ident": "test",
"Tags": null,
"Schema": 0,
"HasAssets": false,
"AssetsPath": null,
"Resources": null,
"MenuResources": null,
"HasCode": false,
"CodePath": null,
"PackageReferences": [],
"EditorReferences": [
"destiny.sandmbit#local"
],
"Metadata": {
"SingleAssetSource": "maps/test.vmap"
}
}
}
{
"publish": {
"Allowed": true,
"Enabled": false,
"ProjectConfig": {
"Title": "test",
"Type": "map",
"Org": "local",
"Ident": "test",
"Tags": null,
"Schema": 0,
"HasAssets": false,
"AssetsPath": null,
"Resources": null,
"MenuResources": null,
"HasCode": false,
"CodePath": null,
"PackageReferences": [],
"EditorReferences": [
"destiny.sandmbit#local"
],
"Metadata": {
"SingleAssetSource": "maps/test.vmap"
}
}
}
}
Loading