Added more weapons

This commit is contained in:
2025-11-07 16:40:56 +03:00
parent 0740570263
commit 32fa3dca57
64 changed files with 459 additions and 37 deletions
+4 -4
View File
@@ -1,10 +1,10 @@
[gd_scene load_steps=8 format=3 uid="uid://1o2ta17yc5bp"]
[ext_resource type="Script" uid="uid://dpqxs8hlql2o0" path="res://game/entities/weapons/abstract_weapon.gd" id="1_x30ps"]
[ext_resource type="PackedScene" uid="uid://cnoiv8hdgossf" path="res://game/entities/weapons/gatling_gun/gatling_projectile.tscn" id="2_7kmqt"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/entities/weapons/reloaders/abstract_reloader.gd" id="3_x30ps"]
[ext_resource type="Script" uid="uid://d2gfhnlbqxsoq" path="res://game/entities/weapons/reloaders/magazine_reloader.gd" id="4_7kmqt"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/entities/weapons/reloaders/firerate_reloader.gd" id="5_jj42u"]
[ext_resource type="PackedScene" uid="uid://cnoiv8hdgossf" path="res://game/entities/weapons/gatling/gatling_projectile.tscn" id="2_7kmqt"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_x30ps"]
[ext_resource type="Script" uid="uid://d2gfhnlbqxsoq" path="res://game/reloaders/magazine_reloader.gd" id="4_7kmqt"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/reloaders/firerate_reloader.gd" id="5_jj42u"]
[sub_resource type="Resource" id="Resource_xi513"]
script = ExtResource("4_7kmqt")
@@ -0,0 +1 @@
uid://db24dm76b1am7
+20
View File
@@ -0,0 +1,20 @@
[gd_scene load_steps=6 format=3 uid="uid://3isnru3m6f84"]
[ext_resource type="Script" uid="uid://db24dm76b1am7" path="res://game/entities/weapons/cannon/cannon.gd" id="1_xnbws"]
[ext_resource type="PackedScene" uid="uid://c6b8qbeaqpni8" path="res://game/entities/weapons/cannon/cannon_projectile.tscn" id="2_2bjeu"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_7e2aj"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/reloaders/firerate_reloader.gd" id="4_bv8g1"]
[sub_resource type="Resource" id="Resource_xyug2"]
script = ExtResource("4_bv8g1")
firerate = 50
metadata/_custom_type_script = "uid://b255rb32vc6co"
[node name="Cannon" type="Node2D"]
script = ExtResource("1_xnbws")
sector_angle = 1
Projectile = ExtResource("2_2bjeu")
reloaders = Array[ExtResource("3_7e2aj")]([SubResource("Resource_xyug2")])
metadata/_custom_type_script = "uid://dpqxs8hlql2o0"
[node name="Sprite2D" type="Sprite2D" parent="."]
@@ -0,0 +1 @@
extends AbstractProjectile
@@ -0,0 +1 @@
uid://dfdh0o88as054
@@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=3 uid="uid://c6b8qbeaqpni8"]
[ext_resource type="Script" uid="uid://dfdh0o88as054" path="res://game/entities/weapons/cannon/cannon_projectile.gd" id="1_20qwt"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_20qwt"]
size = Vector2(6, 6)
[sub_resource type="CircleShape2D" id="CircleShape2D_20qwt"]
radius = 2.0
[node name="CannonProjectile" type="CharacterBody2D"]
script = ExtResource("1_20qwt")
damage = 50
speed = 600
metadata/_custom_type_script = "uid://ctmjb3nkxrepu"
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("PlaceholderTexture2D_20qwt")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_20qwt")
+12
View File
@@ -0,0 +1,12 @@
extends AbstractWeapon
@onready var sprite := $Sprite2D
func _ready() -> void:
var texture := PlaceholderTexture2D.new()
texture.size = Vector2(10, 7)
sprite.texture = texture
super._ready()
@@ -1,28 +1,28 @@
[gd_scene load_steps=8 format=3 uid="uid://c4vvw741175tj"]
[ext_resource type="Script" uid="uid://c1bsvmj7xhnxe" path="res://game/entities/weapons/gatling_gun/gatling_gun.gd" id="1_irb3o"]
[ext_resource type="PackedScene" uid="uid://cnoiv8hdgossf" path="res://game/entities/weapons/gatling_gun/gatling_projectile.tscn" id="2_kifyy"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/entities/weapons/reloaders/abstract_reloader.gd" id="3_lpe3m"]
[ext_resource type="Script" uid="uid://oslebeau3f4b" path="res://game/entities/weapons/reloaders/gatling_reloader.gd" id="4_irb3o"]
[ext_resource type="Script" uid="uid://d2gfhnlbqxsoq" path="res://game/entities/weapons/reloaders/magazine_reloader.gd" id="5_376q2"]
[ext_resource type="Script" uid="uid://c1bsvmj7xhnxe" path="res://game/entities/weapons/gatling/gatling.gd" id="1_kg6du"]
[ext_resource type="PackedScene" uid="uid://cnoiv8hdgossf" path="res://game/entities/weapons/gatling/gatling_projectile.tscn" id="2_ylc0n"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_uucc4"]
[ext_resource type="Script" uid="uid://oslebeau3f4b" path="res://game/reloaders/gatling_reloader.gd" id="4_g81jq"]
[ext_resource type="Script" uid="uid://d2gfhnlbqxsoq" path="res://game/reloaders/magazine_reloader.gd" id="5_tjfs0"]
[sub_resource type="Resource" id="Resource_kifyy"]
script = ExtResource("4_irb3o")
script = ExtResource("4_g81jq")
firerate = 600
spin_out_time = 3
metadata/_custom_type_script = "uid://oslebeau3f4b"
[sub_resource type="Resource" id="Resource_6px3v"]
script = ExtResource("5_376q2")
script = ExtResource("5_tjfs0")
magazine_size = 300
reload_time = 2
metadata/_custom_type_script = "uid://d2gfhnlbqxsoq"
[node name="GatlingGun" type="Node2D"]
script = ExtResource("1_irb3o")
script = ExtResource("1_kg6du")
sector_angle = 5
Projectile = ExtResource("2_kifyy")
reloaders = Array[ExtResource("3_lpe3m")]([SubResource("Resource_kifyy"), SubResource("Resource_6px3v")])
Projectile = ExtResource("2_ylc0n")
reloaders = Array[ExtResource("3_uucc4")]([SubResource("Resource_kifyy"), SubResource("Resource_6px3v")])
metadata/_custom_type_script = "uid://dpqxs8hlql2o0"
[node name="Sprite2D" type="Sprite2D" parent="."]
@@ -0,0 +1 @@
extends AbstractProjectile
@@ -1,6 +1,6 @@
[gd_scene load_steps=4 format=3 uid="uid://cnoiv8hdgossf"]
[ext_resource type="Script" uid="uid://rtsf1n0djorp" path="res://game/entities/weapons/gatling_gun/gatling_projectile.gd" id="1_xq7oi"]
[ext_resource type="Script" uid="uid://rtsf1n0djorp" path="res://game/entities/weapons/gatling/gatling_projectile.gd" id="1_xq7oi"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_xq7oi"]
size = Vector2(4, 4)
@@ -1,9 +0,0 @@
extends AbstractProjectile
func _ready() -> void:
var texture := PlaceholderTexture2D.new()
texture.size = Vector2(4, 4)
$Sprite2D.texture = texture
super._ready()
+12
View File
@@ -0,0 +1,12 @@
extends AbstractWeapon
@onready var sprite := $Sprite2D
func _ready() -> void:
var texture := PlaceholderTexture2D.new()
texture.size = Vector2(10, 7)
sprite.texture = texture
super._ready()
+1
View File
@@ -0,0 +1 @@
uid://bxr150at8ul2a
+27
View File
@@ -0,0 +1,27 @@
[gd_scene load_steps=8 format=3 uid="uid://c67jhwocoevkv"]
[ext_resource type="Script" uid="uid://bxr150at8ul2a" path="res://game/entities/weapons/laser/laser.gd" id="1_pki4x"]
[ext_resource type="PackedScene" uid="uid://d31js2vi7dlit" path="res://game/entities/weapons/laser/laser_projectile.tscn" id="2_fecho"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_c1wcw"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/reloaders/firerate_reloader.gd" id="4_cl0br"]
[ext_resource type="Script" uid="uid://dxk56xdihfw4m" path="res://game/reloaders/energy_reloader.gd" id="5_l3tgo"]
[sub_resource type="Resource" id="Resource_77vow"]
script = ExtResource("4_cl0br")
firerate = 3000
metadata/_custom_type_script = "uid://b255rb32vc6co"
[sub_resource type="Resource" id="Resource_nwpae"]
script = ExtResource("5_l3tgo")
heat_per_shot = 2
heat_capacity = 1000
cooling_down_rate = 2500
metadata/_custom_type_script = "uid://dxk56xdihfw4m"
[node name="Laser" type="Node2D"]
script = ExtResource("1_pki4x")
Projectile = ExtResource("2_fecho")
reloaders = Array[ExtResource("3_c1wcw")]([SubResource("Resource_77vow"), SubResource("Resource_nwpae")])
metadata/_custom_type_script = "uid://dpqxs8hlql2o0"
[node name="Sprite2D" type="Sprite2D" parent="."]
@@ -0,0 +1 @@
extends AbstractProjectile
@@ -0,0 +1 @@
uid://bdxq4aflhc8vd
@@ -0,0 +1,22 @@
[gd_scene load_steps=4 format=3 uid="uid://d31js2vi7dlit"]
[ext_resource type="Script" uid="uid://bdxq4aflhc8vd" path="res://game/entities/weapons/laser/laser_projectile.gd" id="1_3a8fg"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_3a8fg"]
size = Vector2(4, 4)
[sub_resource type="CircleShape2D" id="CircleShape2D_3a8fg"]
radius = 1.0
[node name="LaserProjectile" type="CharacterBody2D"]
motion_mode = 1
script = ExtResource("1_3a8fg")
damage = 1
speed = 240
metadata/_custom_type_script = "uid://ctmjb3nkxrepu"
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("PlaceholderTexture2D_3a8fg")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_3a8fg")
@@ -0,0 +1,12 @@
extends AbstractWeapon
@onready var sprite := $Sprite2D
func _ready() -> void:
var texture := PlaceholderTexture2D.new()
texture.size = Vector2(10, 7)
sprite.texture = texture
super._ready()
@@ -0,0 +1 @@
uid://lauvvj5xhbud
@@ -0,0 +1,20 @@
[gd_scene load_steps=6 format=3 uid="uid://da5hpi3py7hhx"]
[ext_resource type="Script" uid="uid://lauvvj5xhbud" path="res://game/entities/weapons/launcher/launcher.gd" id="1_sk5u1"]
[ext_resource type="PackedScene" uid="uid://du60nb1ni0bco" path="res://game/entities/weapons/launcher/launcher_projectile.tscn" id="2_q88o8"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_1rkeb"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/reloaders/firerate_reloader.gd" id="4_fsoo2"]
[sub_resource type="Resource" id="Resource_8arbu"]
script = ExtResource("4_fsoo2")
firerate = 120
metadata/_custom_type_script = "uid://b255rb32vc6co"
[node name="Launcher" type="Node2D"]
script = ExtResource("1_sk5u1")
sector_angle = 5
Projectile = ExtResource("2_q88o8")
reloaders = Array[ExtResource("3_1rkeb")]([SubResource("Resource_8arbu")])
metadata/_custom_type_script = "uid://dpqxs8hlql2o0"
[node name="Sprite2D" type="Sprite2D" parent="."]
@@ -0,0 +1 @@
extends AbstractProjectile
@@ -0,0 +1 @@
uid://dkvur5bdwg3sr
@@ -0,0 +1,24 @@
[gd_scene load_steps=4 format=3 uid="uid://du60nb1ni0bco"]
[ext_resource type="Script" uid="uid://dkvur5bdwg3sr" path="res://game/entities/weapons/launcher/launcher_projectile.gd" id="1_0mcat"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_0mcat"]
size = Vector2(8, 4)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_0mcat"]
radius = 1.0
height = 6.0
[node name="LauncherProjectile" type="CharacterBody2D"]
motion_mode = 1
script = ExtResource("1_0mcat")
damage = 24
speed = 300
metadata/_custom_type_script = "uid://ctmjb3nkxrepu"
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("PlaceholderTexture2D_0mcat")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5707964
shape = SubResource("CapsuleShape2D_0mcat")
@@ -0,0 +1,12 @@
extends AbstractWeapon
@onready var sprite := $Sprite2D
func _ready() -> void:
var texture := PlaceholderTexture2D.new()
texture.size = Vector2(10, 7)
sprite.texture = texture
super._ready()
@@ -0,0 +1 @@
uid://c3ckkpjaef5jn
@@ -0,0 +1,20 @@
[gd_scene load_steps=6 format=3 uid="uid://beddohbuop7d0"]
[ext_resource type="Script" uid="uid://c3ckkpjaef5jn" path="res://game/entities/weapons/minelayer/minelayer.gd" id="1_12l3k"]
[ext_resource type="PackedScene" uid="uid://dh46vqucky3bo" path="res://game/entities/weapons/minelayer/minelayer_projectile.tscn" id="2_7y446"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_uotj8"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/reloaders/firerate_reloader.gd" id="4_fbmxv"]
[sub_resource type="Resource" id="Resource_vl21o"]
script = ExtResource("4_fbmxv")
firerate = 40
metadata/_custom_type_script = "uid://b255rb32vc6co"
[node name="Minelayer" type="Node2D"]
script = ExtResource("1_12l3k")
sector_angle = 10
Projectile = ExtResource("2_7y446")
reloaders = Array[ExtResource("3_uotj8")]([SubResource("Resource_vl21o")])
metadata/_custom_type_script = "uid://dpqxs8hlql2o0"
[node name="Sprite2D" type="Sprite2D" parent="."]
@@ -0,0 +1 @@
extends AbstractProjectile
@@ -0,0 +1 @@
uid://76swcukelnii
@@ -0,0 +1,24 @@
[gd_scene load_steps=4 format=3 uid="uid://dh46vqucky3bo"]
[ext_resource type="Script" uid="uid://76swcukelnii" path="res://game/entities/weapons/minelayer/minelayer_projectile.gd" id="1_ufc4r"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_ufc4r"]
size = Vector2(16, 16)
[sub_resource type="CircleShape2D" id="CircleShape2D_ufc4r"]
radius = 7.0
[node name="MinelayerProjectile" type="CharacterBody2D"]
motion_mode = 1
script = ExtResource("1_ufc4r")
damage = 100
speed = 200
acceleration = -10
max_livetime = 60
metadata/_custom_type_script = "uid://ctmjb3nkxrepu"
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("PlaceholderTexture2D_ufc4r")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_ufc4r")
+12
View File
@@ -0,0 +1,12 @@
extends AbstractWeapon
@onready var sprite := $Sprite2D
func _ready() -> void:
var texture := PlaceholderTexture2D.new()
texture.size = Vector2(10, 7)
sprite.texture = texture
super._ready()
@@ -0,0 +1 @@
uid://cu6ck2oqqdem8
+28
View File
@@ -0,0 +1,28 @@
[gd_scene load_steps=8 format=3 uid="uid://mhar8dm1ni73"]
[ext_resource type="Script" uid="uid://cu6ck2oqqdem8" path="res://game/entities/weapons/plasma/plasma.gd" id="1_pkk8e"]
[ext_resource type="PackedScene" uid="uid://b2sd3ur65gpwh" path="res://game/entities/weapons/plasma/plasma_projectile.tscn" id="2_yluvp"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_fnsb7"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/reloaders/firerate_reloader.gd" id="4_gpth1"]
[ext_resource type="Script" uid="uid://dxk56xdihfw4m" path="res://game/reloaders/energy_reloader.gd" id="5_daaq0"]
[sub_resource type="Resource" id="Resource_d5x03"]
script = ExtResource("4_gpth1")
firerate = 150
metadata/_custom_type_script = "uid://b255rb32vc6co"
[sub_resource type="Resource" id="Resource_028m2"]
script = ExtResource("5_daaq0")
heat_per_shot = 35
heat_capacity = 1000
cooling_down_rate = 1000
metadata/_custom_type_script = "uid://dxk56xdihfw4m"
[node name="Plasma" type="Node2D"]
script = ExtResource("1_pkk8e")
sector_angle = 2
Projectile = ExtResource("2_yluvp")
reloaders = Array[ExtResource("3_fnsb7")]([SubResource("Resource_d5x03"), SubResource("Resource_028m2")])
metadata/_custom_type_script = "uid://dpqxs8hlql2o0"
[node name="Sprite2D" type="Sprite2D" parent="."]
@@ -0,0 +1 @@
extends AbstractProjectile
@@ -0,0 +1 @@
uid://bu5sjoh4hwkhn
@@ -0,0 +1,22 @@
[gd_scene load_steps=4 format=3 uid="uid://b2sd3ur65gpwh"]
[ext_resource type="Script" uid="uid://bu5sjoh4hwkhn" path="res://game/entities/weapons/plasma/plasma_projectile.gd" id="1_x58hw"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_x58hw"]
size = Vector2(6, 6)
[sub_resource type="CircleShape2D" id="CircleShape2D_x58hw"]
radius = 2.0
[node name="PlasmaProjectile" type="CharacterBody2D"]
motion_mode = 1
script = ExtResource("1_x58hw")
damage = 20
speed = 450
metadata/_custom_type_script = "uid://ctmjb3nkxrepu"
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("PlaceholderTexture2D_x58hw")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_x58hw")
+3 -3
View File
@@ -2,9 +2,9 @@
[ext_resource type="Script" uid="uid://drnofu4ium56e" path="res://game/entities/weapons/railgun/railgun.gd" id="1_5nhwg"]
[ext_resource type="PackedScene" uid="uid://dpd6qm3e3wbjx" path="res://game/entities/weapons/railgun/railgun_projectile.tscn" id="2_cbsia"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/entities/weapons/reloaders/abstract_reloader.gd" id="3_qxka8"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/entities/weapons/reloaders/firerate_reloader.gd" id="4_igknv"]
[ext_resource type="Script" uid="uid://d2gfhnlbqxsoq" path="res://game/entities/weapons/reloaders/magazine_reloader.gd" id="5_buejq"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_qxka8"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/reloaders/firerate_reloader.gd" id="4_igknv"]
[ext_resource type="Script" uid="uid://d2gfhnlbqxsoq" path="res://game/reloaders/magazine_reloader.gd" id="5_buejq"]
[sub_resource type="Resource" id="Resource_6wi8i"]
script = ExtResource("4_igknv")
@@ -1,9 +1 @@
extends AbstractProjectile
func _ready() -> void:
var texture := PlaceholderTexture2D.new()
texture.size = Vector2(6, 6)
$Sprite2D.texture = texture
super._ready()
@@ -1,7 +1,10 @@
[gd_scene load_steps=3 format=3 uid="uid://dpd6qm3e3wbjx"]
[gd_scene load_steps=4 format=3 uid="uid://dpd6qm3e3wbjx"]
[ext_resource type="Script" uid="uid://n3h1e3pj02g0" path="res://game/entities/weapons/railgun/railgun_projectile.gd" id="1_hycpq"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_rfd1j"]
size = Vector2(6, 6)
[sub_resource type="CircleShape2D" id="CircleShape2D_hycpq"]
radius = 2.0
@@ -16,6 +19,7 @@ piercing = 1
metadata/_custom_type_script = "uid://ctmjb3nkxrepu"
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("PlaceholderTexture2D_rfd1j")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_hycpq")
@@ -1,26 +0,0 @@
@abstract
extends Resource
class_name AbstractReloader
var _random := RandomNumberGenerator.new()
@abstract
func process(delta: float) -> void
@abstract
func can_shoot() -> bool
@abstract
func shoot() -> void
@abstract
func reload() -> void
@abstract
func get_process_percent() -> int
@@ -1 +0,0 @@
uid://ccpriilfr3kme
@@ -1,66 +0,0 @@
extends AbstractReloader
class_name EnergyReloader
@export var heat_per_shot : int:
set(value):
heat_per_shot = value
_calculate_critical_heat()
@export var heat_capacity : int:
set(value):
heat_capacity = value
_calculate_critical_heat()
@export var cooling_down_rate : int:
set(value):
cooling_down_rate = value
_calculate_cool()
var _cool_per_sec : float
var _cool_per_sec_tenth : float
var _heat : float
var _critical_heat : int
func _ready() -> void:
_calculate_critical_heat()
_calculate_cool()
func process(delta: float) -> void:
if _heat > 0:
_heat -= _cool_per_sec * delta
if _heat < 0:
_heat = 0
func can_shoot() -> bool:
return _heat <= _critical_heat
func shoot() -> void:
var random_heat := _random.randf_range(-_cool_per_sec_tenth, _cool_per_sec_tenth)
_heat += heat_per_shot + random_heat
func reload() -> void:
pass
func get_process_percent() -> int:
return 100 - int(_heat * 100 / heat_capacity)
func _calculate_critical_heat() -> void:
_critical_heat = heat_capacity - heat_per_shot
func _calculate_cool() -> void:
_cool_per_sec = cooling_down_rate / 60.0
_cool_per_sec_tenth = _cool_per_sec / 10
@@ -1 +0,0 @@
uid://dxk56xdihfw4m
@@ -1,44 +0,0 @@
extends AbstractReloader
class_name FirerateReloader
@export var firerate : int:
set(value):
firerate = value
_calculate_delay()
var _delay : float
var _delay_tenth : float
var _cooldown : float
func _ready() -> void:
_calculate_delay()
func process(delta: float) -> void:
if _cooldown > 0:
_cooldown -= delta
func can_shoot() -> bool:
return _cooldown <= 0
func shoot() -> void:
var random_delay := _random.randf_range(-_delay_tenth, _delay_tenth)
_cooldown = _delay + random_delay
func reload() -> void:
pass
func get_process_percent() -> int:
return 100 - int(_cooldown * 100 / _delay)
func _calculate_delay() -> void:
_delay = 60.0 / firerate
_delay_tenth = _delay / 10
@@ -1 +0,0 @@
uid://b255rb32vc6co
@@ -1,64 +0,0 @@
extends AbstractReloader
class_name GatlingReloader
@export var firerate : int:
set(value):
firerate = value
_calculate_delay()
@export var spin_out_time : int:
set(value):
spin_out_time = value
_calculate_delay()
const INITIAL_DELAY = 1.0
var _target_delay : float
var _current_delay : float = INITIAL_DELAY
var _delay_decrement : float
var _cooldown : float
var _last_delta : float
func _ready() -> void:
_calculate_delay()
func process(delta: float) -> void:
if _cooldown > 0:
_cooldown -= delta
if _current_delay < INITIAL_DELAY:
_decrease_delay(_delay_decrement * -delta)
_last_delta = delta
func can_shoot() -> bool:
_decrease_delay(_delay_decrement * 2 * _last_delta)
return _cooldown <= 0
func shoot() -> void:
_cooldown = _current_delay
func reload() -> void:
pass
func get_process_percent() -> int:
return 100 - int(_cooldown * 100 / _current_delay)
func _calculate_delay() -> void:
_target_delay = 60.0 / firerate
_delay_decrement = (INITIAL_DELAY - _target_delay)/spin_out_time
func _decrease_delay(delay_decrement: float) -> void:
_current_delay = _current_delay - delay_decrement
_current_delay = clampf(_current_delay, _target_delay, INITIAL_DELAY)
@@ -1 +0,0 @@
uid://oslebeau3f4b
@@ -1,62 +0,0 @@
extends AbstractReloader
class_name MagazineReloader
@export var magazine_size : int:
set(value):
magazine_size = value
_calculate_bullets_in_magazine()
@export var reload_time : int:
set(value):
reload_time = value
_calculate_reload_time_tenth()
var _bullets_in_magazine : int
var _reload_time_tenth : float
var _countdown : float
func _ready() -> void:
_calculate_bullets_in_magazine()
_calculate_reload_time_tenth()
func process(delta: float) -> void:
if _countdown > 0:
_countdown -= delta
if _countdown <= 0:
_bullets_in_magazine = magazine_size
func can_shoot() -> bool:
return _countdown <= 0
func shoot() -> void:
if _bullets_in_magazine > 0:
_bullets_in_magazine -= 1
if _bullets_in_magazine == 0:
reload()
func reload() -> void:
if _countdown > 0 or _bullets_in_magazine == magazine_size: return
var random_delay := _random.randf_range(-_reload_time_tenth, _reload_time_tenth)
_countdown = reload_time + random_delay
print("reload")
func get_process_percent() -> int:
return 100 - int(_countdown * 100 / reload_time)
func _calculate_bullets_in_magazine() -> void:
_bullets_in_magazine = magazine_size
func _calculate_reload_time_tenth() -> void:
_reload_time_tenth = reload_time / 10.0
@@ -1 +0,0 @@
uid://d2gfhnlbqxsoq
@@ -0,0 +1,12 @@
extends AbstractWeapon
@onready var sprite := $Sprite2D
func _ready() -> void:
var texture := PlaceholderTexture2D.new()
texture.size = Vector2(10, 7)
sprite.texture = texture
super._ready()
@@ -0,0 +1 @@
uid://gxwbsiicuqh5
@@ -0,0 +1,28 @@
[gd_scene load_steps=8 format=3 uid="uid://cy7g35uoq3ts"]
[ext_resource type="Script" uid="uid://gxwbsiicuqh5" path="res://game/entities/weapons/shrapnel/shrapnel.gd" id="1_xk300"]
[ext_resource type="PackedScene" uid="uid://7pe0un48uedn" path="res://game/entities/weapons/shrapnel/shrapnel_projectile.tscn" id="2_xvd4y"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_tyrw7"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/reloaders/firerate_reloader.gd" id="4_nfmol"]
[ext_resource type="Script" uid="uid://d2gfhnlbqxsoq" path="res://game/reloaders/magazine_reloader.gd" id="5_mw83u"]
[sub_resource type="Resource" id="Resource_8lwl1"]
script = ExtResource("4_nfmol")
firerate = 100
metadata/_custom_type_script = "uid://b255rb32vc6co"
[sub_resource type="Resource" id="Resource_xcpx0"]
script = ExtResource("5_mw83u")
magazine_size = 35
reload_time = 5
metadata/_custom_type_script = "uid://d2gfhnlbqxsoq"
[node name="Shrapnel" type="Node2D"]
script = ExtResource("1_xk300")
bullet_per_shot = 20
sector_angle = 30
Projectile = ExtResource("2_xvd4y")
reloaders = Array[ExtResource("3_tyrw7")]([SubResource("Resource_8lwl1"), SubResource("Resource_xcpx0")])
metadata/_custom_type_script = "uid://dpqxs8hlql2o0"
[node name="Sprite2D" type="Sprite2D" parent="."]
@@ -0,0 +1 @@
extends AbstractProjectile
@@ -0,0 +1 @@
uid://ctnje7pjanaws
@@ -0,0 +1,23 @@
[gd_scene load_steps=4 format=3 uid="uid://7pe0un48uedn"]
[ext_resource type="Script" uid="uid://ctnje7pjanaws" path="res://game/entities/weapons/shrapnel/shrapnel_projectile.gd" id="1_yu2c6"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_yu2c6"]
size = Vector2(4, 4)
[sub_resource type="CircleShape2D" id="CircleShape2D_yu2c6"]
radius = 1.0
[node name="ShrapnelProjectile" type="CharacterBody2D"]
motion_mode = 1
script = ExtResource("1_yu2c6")
damage = 2
speed = 500
max_distance = 120
metadata/_custom_type_script = "uid://ctmjb3nkxrepu"
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("PlaceholderTexture2D_yu2c6")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_yu2c6")
+12
View File
@@ -0,0 +1,12 @@
extends AbstractWeapon
@onready var sprite := $Sprite2D
func _ready() -> void:
var texture := PlaceholderTexture2D.new()
texture.size = Vector2(10, 7)
sprite.texture = texture
super._ready()
+1
View File
@@ -0,0 +1 @@
uid://ctv408wdwvttc
+28
View File
@@ -0,0 +1,28 @@
[gd_scene load_steps=8 format=3 uid="uid://dpwdl7kcf0sng"]
[ext_resource type="Script" uid="uid://ctv408wdwvttc" path="res://game/entities/weapons/tesla/tesla.gd" id="1_rpud7"]
[ext_resource type="PackedScene" uid="uid://dmvxynbo5bpyw" path="res://game/entities/weapons/tesla/tesla_projectile.tscn" id="2_1rrdy"]
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_08si3"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/reloaders/firerate_reloader.gd" id="4_rqarv"]
[ext_resource type="Script" uid="uid://dxk56xdihfw4m" path="res://game/reloaders/energy_reloader.gd" id="5_j5i31"]
[sub_resource type="Resource" id="Resource_jo1m1"]
script = ExtResource("4_rqarv")
firerate = 45
metadata/_custom_type_script = "uid://b255rb32vc6co"
[sub_resource type="Resource" id="Resource_7s0el"]
script = ExtResource("5_j5i31")
heat_per_shot = 150
heat_capacity = 1000
cooling_down_rate = 2500
metadata/_custom_type_script = "uid://dxk56xdihfw4m"
[node name="Tesla" type="Node2D"]
script = ExtResource("1_rpud7")
sector_angle = 180
Projectile = ExtResource("2_1rrdy")
reloaders = Array[ExtResource("3_08si3")]([SubResource("Resource_jo1m1"), SubResource("Resource_7s0el")])
metadata/_custom_type_script = "uid://dpqxs8hlql2o0"
[node name="Sprite2D" type="Sprite2D" parent="."]
@@ -0,0 +1 @@
extends AbstractProjectile
@@ -0,0 +1 @@
uid://bxcoa2eps0tt1
@@ -0,0 +1,22 @@
[gd_scene load_steps=4 format=3 uid="uid://dmvxynbo5bpyw"]
[ext_resource type="Script" uid="uid://bxcoa2eps0tt1" path="res://game/entities/weapons/tesla/tesla_projectile.gd" id="1_1oexk"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_1oexk"]
size = Vector2(12, 12)
[sub_resource type="CircleShape2D" id="CircleShape2D_1oexk"]
radius = 5.0
[node name="TeslaProjectile" type="CharacterBody2D"]
motion_mode = 1
script = ExtResource("1_1oexk")
damage = 45
speed = 900
metadata/_custom_type_script = "uid://ctmjb3nkxrepu"
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("PlaceholderTexture2D_1oexk")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_1oexk")