sasalka/Code/Inventory/Definitions/WeaponItemDefinition.cs
2025-06-29 12:22:15 +03:00

69 lines
2.1 KiB
C#

using Sandbox.Citizen;
namespace Sasalka;
[GameResource( "Weapon Item Definition", "weapon", "", Category = "Sasalka", Icon = "inventory_2" )]
public class WeaponItemDefinition : BaseItemDefinition, IEquipable
{
[Property, Category( "Weapon Properties" )]
public Inventar.InventorySlot Slot { get; set; }
[Property, Category( "Weapon Properties" )]
public CitizenAnimationHelper.HoldTypes HoldType { get; set; } = CitizenAnimationHelper.HoldTypes.None;
[Property, Category( "Weapon Properties" )]
[InlineEditor, Space]
public WeaponDefinition WeaponDefinition { get; set; }
[Property, Category( "Weapon Properties" )]
public float Damage { get; set; } = 10f;
[Property, Category( "Weapon Properties" )]
public float FireRate { get; set; } = 10f; // Выстрелов в секунду
[Property, Category( "Weapon Properties" )]
public float Range { get; set; } = 1000f;
[Property, Category( "Weapon Properties" )]
public int MagazineSize { get; set; } = 30;
[Property, Category( "Weapon Properties" )]
public string AmmoType { get; set; } = "Pistol";
[Property, Category( "Weapon Properties" )]
public float ReloadTime { get; set; } = 2f;
[Property, Category( "Weapon Properties" )]
public float Spread { get; set; } = 0.02f; // Разброс при стрельбе
[Property, Category( "Weapon Properties" )]
public bool IsAutomatic { get; set; } = true; // Всегда автоматический режим
public override Inventar.InventorySlot? GetSlot() => Slot;
public override ItemCategory Category => ItemCategory.Weapon;
public override bool CanUse() => true;
public override void OnUse( InventoryItem item )
{
// Логика использования оружия будет в компоненте Weapon
}
}
public struct WeaponDefinition
{
[Property] public Vector3 Position { get; set; }
[Property] public Rotation Rotation { get; set; }
[Property] public Vector3 Scale { get; set; } = new Vector3( 1, 1, 1 );
public WeaponDefinition()
{
Position = Vector3.Zero;
Rotation = Rotation.Identity;
Scale = Vector3.One;
}
}