Add projectiles

This commit is contained in:
2026-02-10 18:03:53 -08:00
parent 2f377d2d7a
commit 92b4e8662f
41 changed files with 2170 additions and 42 deletions

View File

@@ -0,0 +1,49 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using Zennysoft.Game.Abstractions;
using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
[Meta(typeof(IAutoNode)), Id("ammo")]
public partial class Ammo : EquipableItem, IStackable
{
public override void _Notification(int what) => this.Notify(what);
private int _count;
[Node] private Sprite3D _sprite { get; set; }
public void OnReady()
{
_count = Stats.InitialCount;
_sprite.Texture = Stats.Texture;
}
public override string ItemName => Stats.Name;
public override string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public override ItemTag ItemTag => Stats.ItemTag;
public override Texture2D GetTexture() => Stats.Texture;
[Save("ammo_item_count")]
public int Count { get => _count; }
public void SetCount(int count) => _count = count;
[Save("ammo_element")]
public ElementType AmmoElement => Stats.AmmoElement;
[Export]
[Save("ammo_stats")]
public AmmoStats Stats { get; set; } = new AmmoStats();
}

View File

@@ -0,0 +1 @@
uid://dsvj25b1dd8ml

View File

@@ -0,0 +1,38 @@
[gd_scene load_steps=4 format=3 uid="uid://dgwaspx08qg8w"]
[ext_resource type="Script" uid="uid://dsvj25b1dd8ml" path="res://src/items/ammo/Ammo.cs" id="1_40de3"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_40de3"]
[sub_resource type="BoxShape3D" id="BoxShape3D_qdeu2"]
size = Vector3(0.898941, 2.34974, 0.86676)
[node name="Ammo" type="RigidBody3D"]
collision_layer = 0
axis_lock_linear_x = true
axis_lock_linear_z = true
axis_lock_angular_x = true
axis_lock_angular_y = true
axis_lock_angular_z = true
script = ExtResource("1_40de3")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.720724, 0)
shape = SubResource("CapsuleShape3D_40de3")
[node name="Pickup" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.49274, 0)
collision_layer = 4
collision_mask = 0
[node name="Sprite" type="Sprite3D" parent="Pickup"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.370004, 0)
pixel_size = 0.025
billboard = 2
texture_filter = 0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Pickup"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00804907, 0.709896, 0.0675965)
shape = SubResource("BoxShape3D_qdeu2")

View File

@@ -0,0 +1,19 @@
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
[GlobalClass]
[Meta, Id("ammo_stat_type")]
public partial class AmmoStats : InventoryItemStats
{
[Export]
[Save("ammo_element")]
public ElementType AmmoElement { get; set; } = ElementType.None;
[Export]
[Save("ammo_initial_count")]
public int InitialCount { get; set; } = 0;
}

View File

@@ -0,0 +1 @@
uid://cmfwvjjargi0s

View File

@@ -0,0 +1,30 @@
[gd_resource type="Resource" script_class="AmmoStats" load_steps=3 format=3 uid="uid://kbialkqo0ibs"]
[ext_resource type="Texture2D" uid="uid://d07kcaqe682l1" path="res://src/items/ammo/textures/AirGeo.png" id="1_llp80"]
[ext_resource type="Script" uid="uid://cmfwvjjargi0s" path="res://src/items/ammo/AmmoStats.cs" id="1_y5266"]
[resource]
script = ExtResource("1_y5266")
AmmoElement = 1
InitialCount = 5
Name = "Aeolic Ammo"
Description = "Aeolic ammo.
Can be used with a Geomantic Reactor."
SpawnRate = 0.5
BonusAttack = 0
BonusDefense = 0
BonusLuck = 5
BonusHP = 0
BonusVT = 0
AeolicResistance = 0
TelluricResistance = 0
HydricResistance = 0
IgneousResistance = 0
FerrumResistance = 0
HolyResistance = 0
CurseResistance = 0
ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_llp80")
metadata/_custom_type_script = "uid://cmfwvjjargi0s"

View File

@@ -0,0 +1,30 @@
[gd_resource type="Resource" script_class="AmmoStats" load_steps=3 format=3 uid="uid://cpyosjclxlh88"]
[ext_resource type="Texture2D" uid="uid://dhl6pwp71y8qm" path="res://src/items/ammo/textures/WATER.png" id="1_mv5fs"]
[ext_resource type="Script" uid="uid://cmfwvjjargi0s" path="res://src/items/ammo/AmmoStats.cs" id="2_tu38n"]
[resource]
script = ExtResource("2_tu38n")
AmmoElement = 3
InitialCount = 5
Name = "Hydric Ammo"
Description = "Hydric ammo.
Can be used with a Geomantic Reactor."
SpawnRate = 0.5
BonusAttack = 0
BonusDefense = 0
BonusLuck = 5
BonusHP = 0
BonusVT = 0
AeolicResistance = 0
TelluricResistance = 0
HydricResistance = 0
IgneousResistance = 0
FerrumResistance = 0
HolyResistance = 0
CurseResistance = 0
ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_mv5fs")
metadata/_custom_type_script = "uid://cmfwvjjargi0s"

View File

@@ -0,0 +1,30 @@
[gd_resource type="Resource" script_class="AmmoStats" load_steps=3 format=3 uid="uid://bltcy30dohjrf"]
[ext_resource type="Texture2D" uid="uid://fv4oewtohgnc" path="res://src/items/ammo/textures/firegeo.png" id="1_6lwo5"]
[ext_resource type="Script" uid="uid://cmfwvjjargi0s" path="res://src/items/ammo/AmmoStats.cs" id="2_p60hg"]
[resource]
script = ExtResource("2_p60hg")
AmmoElement = 4
InitialCount = 5
Name = "Igneous Ammo"
Description = "Igneous ammo.
Can be used with a Geomantic Reactor."
SpawnRate = 0.5
BonusAttack = 0
BonusDefense = 0
BonusLuck = 5
BonusHP = 0
BonusVT = 0
AeolicResistance = 0
TelluricResistance = 0
HydricResistance = 0
IgneousResistance = 0
FerrumResistance = 0
HolyResistance = 0
CurseResistance = 0
ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_6lwo5")
metadata/_custom_type_script = "uid://cmfwvjjargi0s"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d07kcaqe682l1"
path="res://.godot/imported/AirGeo.png-e873d044dab8a5ca7182624c0d3c0a6a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/items/ammo/textures/AirGeo.png"
dest_files=["res://.godot/imported/AirGeo.png-e873d044dab8a5ca7182624c0d3c0a6a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dhl6pwp71y8qm"
path.s3tc="res://.godot/imported/WATER.png-32a77fe0c80fb86759ee73e99a0ca4f4.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://src/items/ammo/textures/WATER.png"
dest_files=["res://.godot/imported/WATER.png-32a77fe0c80fb86759ee73e99a0ca4f4.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://br8bo6b52q3lh"
path="res://.godot/imported/ammo1.png-06763d467a08becf4c1fff96699f83ac.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/items/ammo/textures/ammo1.png"
dest_files=["res://.godot/imported/ammo1.png-06763d467a08becf4c1fff96699f83ac.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://vxajas4napo0"
path="res://.godot/imported/earth.png-936a4bae3599693c89b44a4663411cd7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/items/ammo/textures/earth.png"
dest_files=["res://.godot/imported/earth.png-936a4bae3599693c89b44a4663411cd7.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://fv4oewtohgnc"
path="res://.godot/imported/firegeo.png-345a11c3605f17539d8d173c23b330d5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/items/ammo/textures/firegeo.png"
dest_files=["res://.godot/imported/firegeo.png-345a11c3605f17539d8d173c23b330d5.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0