inching towards better class inheritence and multiplayer compatibility

This commit is contained in:
2023-11-15 15:19:40 +11:00
parent f004f64b71
commit 1500c22ccc
204 changed files with 1920 additions and 1951 deletions

View File

@ -1,19 +1,23 @@
[gd_resource type="Resource" script_class="Card" load_steps=7 format=3 uid="uid://q23ludhji5p4"]
[gd_resource type="Resource" script_class="Card" load_steps=8 format=3 uid="uid://cvto66tp7rrst"]
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_5html"]
[ext_resource type="Texture2D" uid="uid://d1am28tgvwaa0" path="res://Assets/TextureAtlases/g_accelerator.tres" id="2_a3hso"]
[ext_resource type="Resource" uid="uid://cc20tomywj0jm" path="res://Resources/TurretStats/accelerator.tres" id="3_yj53i"]
[ext_resource type="PackedScene" uid="uid://rcqf3vangjlp" path="res://PCs/Universal/ClassCards/Gatling/weapon_gatling.tscn" id="4_4xp1m"]
[ext_resource type="PackedScene" uid="uid://bwcdgglljbmot" path="res://PCs/Universal/ClassCards/Gatling/tower_gatling.tscn" id="4_maix8"]
[ext_resource type="Resource" uid="uid://ouwge5etb4me" path="res://Resources/WeaponStats/accelerator.tres" id="5_hguan"]
[ext_resource type="Texture2D" uid="uid://cx5cwn11fuugq" path="res://PCs/Universal/ClassCards/Gatling/gatling.png" id="2_rof1s"]
[ext_resource type="Resource" uid="uid://nxl5wabgl36t" path="res://PCs/Universal/ClassCards/Gatling/tower_stats.tres" id="3_4hykq"]
[ext_resource type="PackedScene" uid="uid://dkxi1ssoa44jn" path="res://PCs/Universal/ClassCards/Gatling/weapon_gatling.tscn" id="3_wkjyf"]
[ext_resource type="Resource" uid="uid://cj2x1jvo8l4ot" path="res://PCs/Universal/ClassCards/Gatling/weapon_stats.tres" id="4_76fd1"]
[ext_resource type="PackedScene" uid="uid://bjuc3x7u3f271" path="res://PCs/Universal/ClassCards/Gatling/tower_gatling.tscn" id="4_thk7u"]
[sub_resource type="AtlasTexture" id="AtlasTexture_rwa4l"]
atlas = ExtResource("2_rof1s")
region = Rect2(0, 0, 64, 64)
[resource]
script = ExtResource("1_5html")
title = "Gatling"
rarity = 0
faction = 0
sprite = ExtResource("2_a3hso")
turret = ExtResource("4_maix8")
weapon = ExtResource("4_4xp1m")
weapon_stats = ExtResource("5_hguan")
tower_stats = ExtResource("3_yj53i")
sprite = SubResource("AtlasTexture_rwa4l")
turret_scene = ExtResource("4_thk7u")
weapon_scene = ExtResource("3_wkjyf")
weapon_stats = ExtResource("4_76fd1")
tower_stats = ExtResource("3_4hykq")

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cx5cwn11fuugq"
path="res://.godot/imported/gatling.png-884c4cce4654c4213d5c047580076c33.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://PCs/Universal/ClassCards/Gatling/gatling.png"
dest_files=["res://.godot/imported/gatling.png-884c4cce4654c4213d5c047580076c33.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=true
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

View File

@ -1,32 +0,0 @@
extends Tower
class_name SpeedyTower
var third_cooldown := 0.0
var time_since_firing_started := 0.0
var time_to_reach_max_speed := 3.0
var max_speed_multiplier := 2.0
var destination_multiplier := 0.0
func _ready() -> void:
cooldown = 1.0 / stats.fire_rate
destination_multiplier = 1.0 / max_speed_multiplier
func _process(delta: float) -> void:
other_cooldown -= delta
if !targeted_enemy:
acquire_target()
else:
if model.global_position.distance_to(targeted_enemy.global_position) > stats.fire_range:
targeted_enemy = null
time_since_firing_started = 0.0
third_cooldown = cooldown
if targeted_enemy:
time_since_firing_started += delta
var progress = clamp(time_since_firing_started / time_to_reach_max_speed, 0, 1.0)
third_cooldown = cooldown * (1.0 - (destination_multiplier * progress))
aim()
if other_cooldown <= 0:
shoot()
other_cooldown = third_cooldown

View File

@ -1,60 +0,0 @@
extends Weapon
class_name SpeedyWeapon
var third_cooldown := 0.0
var time_since_firing_started := 0.0
var time_to_reach_max_speed := 3.0
var max_speed_multiplier := 2.0
var destination_multiplier := 0.0
func _ready() -> void:
cooldown = 1.0 / stats.fire_rate
destination_multiplier = 1.0 / max_speed_multiplier
$RayCast3D.target_position = Vector3(0, 0, -stats.fire_range)
func set_raycast_origin(node):
$RayCast3D.global_position = node.global_position
func _process(delta: float) -> void:
if stats != null:
other_cooldown -= delta
if trigger_held:
time_since_firing_started += delta
var progress = clamp(time_since_firing_started / time_to_reach_max_speed, 0, 1.0)
third_cooldown = cooldown * (1.0 - (destination_multiplier * progress))
func _physics_process(_delta: float) -> void:
if trigger_held:
shoot()
func hold_trigger():
trigger_held = true
func release_trigger():
trigger_held = false
time_since_firing_started = 0.0
third_cooldown = cooldown
func shoot():
if other_cooldown <= 0 and stats != null:
other_cooldown = third_cooldown
$AnimationPlayer.play("shoot")
if $RayCast3D.is_colliding():
var target = $RayCast3D.get_collider()
if target != null:
var target_hitbox = target.shape_owner_get_owner($RayCast3D.get_collider_shape())
if target_hitbox is Hitbox:
target_hitbox.damage(stats.damage)
@rpc
func networked_shoot():
$AnimationPlayer.play("shoot")

View File

@ -0,0 +1,38 @@
extends HitscanTower
class_name GatlingTower
var time_since_firing_started := 0.0
var time_to_reach_max_speed := 0.0
var max_speed_multiplier := 0.0
var current_time_between_shots := 0.0
var final_time_between_shots := 0.0
func _ready() -> void:
super._ready()
time_to_reach_max_speed = stats.get_attribute("Speed Time")
max_speed_multiplier = stats.get_attribute("Speed Multiplier")
final_time_between_shots = time_between_shots / max_speed_multiplier
func _process(delta: float) -> void:
if time_since_firing < current_time_between_shots:
time_since_firing += delta
func _physics_process(delta: float) -> void:
if !targeted_enemy:
acquire_target()
else:
if !targeted_enemy.alive or global_position.distance_to(targeted_enemy.global_position) > target_range:
targeted_enemy = null
time_since_firing_started = 0.0
current_time_between_shots = time_between_shots
if targeted_enemy:
aim()
time_since_firing_started += delta
var progress = clamp(time_since_firing_started / time_to_reach_max_speed, 0, 1.0)
current_time_between_shots = lerpf(time_between_shots, final_time_between_shots, progress)
if time_since_firing >= current_time_between_shots:
time_since_firing -= current_time_between_shots
shoot()

View File

@ -1,57 +1,9 @@
[gd_scene load_steps=4 format=3 uid="uid://bwcdgglljbmot"]
[gd_scene load_steps=4 format=3 uid="uid://bjuc3x7u3f271"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Gatling/speedytower.gd" id="1_26he3"]
[ext_resource type="Resource" uid="uid://cc20tomywj0jm" path="res://Resources/TurretStats/accelerator.tres" id="2_puwlv"]
[ext_resource type="PackedScene" uid="uid://dumiyjlnea4gq" path="res://Scenes/Towers/hitscan_tower.tscn" id="1_su74p"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Gatling/tower_gatling.gd" id="2_ipjp1"]
[ext_resource type="Resource" uid="uid://nxl5wabgl36t" path="res://PCs/Universal/ClassCards/Gatling/tower_stats.tres" id="3_oicqw"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_73y0x"]
transparency = 1
cull_mode = 2
shading_mode = 0
albedo_color = Color(0.686275, 0, 0, 0.278431)
[node name="Node3D" type="Node3D" node_paths=PackedStringArray("model", "range_sphere", "minimap_range_sphere")]
script = ExtResource("1_26he3")
stats = ExtResource("2_puwlv")
model = NodePath("Model")
range_sphere = NodePath("Model/CSGSphere3D")
minimap_range_sphere = NodePath("Model/CSGSphere3D2")
[node name="Model" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="CSGBox3D" type="CSGBox3D" parent="Model"]
[node name="CSGBox3D2" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00131059, 0.27342, -0.880753)
size = Vector3(0.177, 0.148, 0.929)
[node name="CSGBox3D3" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.226066, 0.0918715, -0.880753)
size = Vector3(0.177, 0.148, 0.929)
[node name="CSGBox3D4" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.227674, -0.174673, -0.880753)
size = Vector3(0.177, 0.148, 0.929)
[node name="CSGBox3D5" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00246562, -0.314903, -0.880753)
size = Vector3(0.177, 0.148, 0.929)
[node name="CSGBox3D6" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.259054, -0.125834, -0.880753)
size = Vector3(0.177, 0.148, 0.929)
[node name="CSGBox3D7" type="CSGBox3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.26701, 0.102116, -0.880753)
size = Vector3(0.177, 0.148, 0.929)
[node name="CSGSphere3D" type="CSGSphere3D" parent="Model"]
visible = false
radius = 7.5
material = SubResource("StandardMaterial3D_73y0x")
[node name="CSGSphere3D2" type="CSGSphere3D" parent="Model"]
visible = false
layers = 4
radius = 7.5
material = SubResource("StandardMaterial3D_73y0x")
[node name="GatlingTower" instance=ExtResource("1_su74p")]
script = ExtResource("2_ipjp1")
stats = ExtResource("3_oicqw")

View File

@ -0,0 +1,37 @@
[gd_resource type="Resource" script_class="CardText" load_steps=8 format=3 uid="uid://nxl5wabgl36t"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_80xci"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_nu6vr"]
[sub_resource type="Resource" id="Resource_oayfg"]
script = ExtResource("1_nu6vr")
key = "Fire Delay"
value = 1.0
[sub_resource type="Resource" id="Resource_fekle"]
script = ExtResource("1_nu6vr")
key = "Damage"
value = 1.0
[sub_resource type="Resource" id="Resource_ud8xi"]
script = ExtResource("1_nu6vr")
key = "Range"
value = 10.0
[sub_resource type="Resource" id="Resource_cvkxf"]
script = ExtResource("1_nu6vr")
key = "Speed Multiplier"
value = 2.0
[sub_resource type="Resource" id="Resource_pivwn"]
script = ExtResource("1_nu6vr")
key = "Speed Time"
value = 3.0
[resource]
script = ExtResource("1_80xci")
target_type = 1
attributes = Array[ExtResource("1_nu6vr")]([SubResource("Resource_oayfg"), SubResource("Resource_fekle"), SubResource("Resource_ud8xi"), SubResource("Resource_cvkxf"), SubResource("Resource_pivwn")])
text = "Fires a shot every [Fire Delay] seconds dealing [Damage] damage at a range of [Range]m
While attacking the same target, gradually accelerates to [Speed Multiplier] times the fire rate over [Speed Time]"

View File

@ -0,0 +1,36 @@
extends HitscanWeapon
class_name GatlingWeapon
var time_since_firing_started := 0.0
var time_to_reach_max_speed := 0.0
var max_speed_multiplier := 0.0
var current_time_between_shots := 0.0
var final_time_between_shots := 0.0
func _ready() -> void:
super._ready()
time_to_reach_max_speed = stats.get_attribute("Speed Time")
max_speed_multiplier = stats.get_attribute("Speed Multiplier")
final_time_between_shots = time_between_shots / max_speed_multiplier
func _process(delta: float) -> void:
super._process(delta)
if trigger_held:
time_since_firing_started += delta
var progress = clamp(time_since_firing_started / time_to_reach_max_speed, 0, 1.0)
current_time_between_shots = lerpf(time_between_shots, final_time_between_shots, progress)
func _physics_process(_delta: float) -> void:
if trigger_held and time_since_firing >= current_time_between_shots:
time_since_firing -= current_time_between_shots
shoot()
networked_shoot.rpc()
func release_trigger():
super.release_trigger()
time_since_firing_started = 0.0
current_time_between_shots = time_between_shots

View File

@ -1,58 +1,15 @@
[gd_scene load_steps=7 format=3 uid="uid://rcqf3vangjlp"]
[gd_scene load_steps=5 format=3 uid="uid://dkxi1ssoa44jn"]
[ext_resource type="Texture2D" uid="uid://d1am28tgvwaa0" path="res://Assets/TextureAtlases/g_accelerator.tres" id="1_n3tw0"]
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Gatling/speedyweapon.gd" id="2_fkecd"]
[ext_resource type="Resource" uid="uid://ouwge5etb4me" path="res://Resources/WeaponStats/accelerator.tres" id="3_nq6wu"]
[ext_resource type="PackedScene" uid="uid://difwo7wlyqr3h" path="res://Scenes/Weapons/hitscan_weapon.tscn" id="1_fwlu5"]
[ext_resource type="Resource" uid="uid://cj2x1jvo8l4ot" path="res://PCs/Universal/ClassCards/Gatling/weapon_stats.tres" id="2_fnyjd"]
[ext_resource type="Texture2D" uid="uid://cx5cwn11fuugq" path="res://PCs/Universal/ClassCards/Gatling/gatling.png" id="2_rv8ps"]
[sub_resource type="Animation" id="Animation_n8b32"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Rect2(0, 0, 64, 64)]
}
[sub_resource type="AtlasTexture" id="AtlasTexture_0im1y"]
atlas = ExtResource("2_rv8ps")
region = Rect2(0, 0, 64, 64)
[sub_resource type="Animation" id="Animation_g0h8q"]
resource_name = "shoot"
length = 0.15
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.15),
"transitions": PackedFloat32Array(0, 0),
"update": 0,
"values": [Rect2(64, 0, 64, 64), Rect2(0, 0, 64, 64)]
}
[node name="HitscanWeapon" instance=ExtResource("1_fwlu5")]
stats = ExtResource("2_fnyjd")
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ntl6p"]
_data = {
"RESET": SubResource("Animation_n8b32"),
"shoot": SubResource("Animation_g0h8q")
}
[node name="Weapon" type="Sprite3D"]
layers = 2
billboard = 1
texture_filter = 0
texture = ExtResource("1_n3tw0")
script = ExtResource("2_fkecd")
stats = ExtResource("3_nq6wu")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_ntl6p")
}
[node name="RayCast3D" type="RayCast3D" parent="."]
collision_mask = 4
[node name="Sprite3D" parent="." index="0"]
texture = SubResource("AtlasTexture_0im1y")

View File

@ -0,0 +1,37 @@
[gd_resource type="Resource" script_class="CardText" load_steps=8 format=3 uid="uid://cj2x1jvo8l4ot"]
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="1_630yu"]
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_vpmor"]
[sub_resource type="Resource" id="Resource_fi7tc"]
script = ExtResource("1_vpmor")
key = "Fire Delay"
value = 0.4
[sub_resource type="Resource" id="Resource_r6h5d"]
script = ExtResource("1_vpmor")
key = "Damage"
value = 2.0
[sub_resource type="Resource" id="Resource_gwg1i"]
script = ExtResource("1_vpmor")
key = "Range"
value = 20.0
[sub_resource type="Resource" id="Resource_ogk1x"]
script = ExtResource("1_vpmor")
key = "Speed Multiplier"
value = 2.0
[sub_resource type="Resource" id="Resource_wdp3h"]
script = ExtResource("1_vpmor")
key = "Speed Time"
value = 3.0
[resource]
script = ExtResource("1_630yu")
target_type = 0
attributes = Array[ExtResource("1_vpmor")]([SubResource("Resource_fi7tc"), SubResource("Resource_r6h5d"), SubResource("Resource_gwg1i"), SubResource("Resource_ogk1x"), SubResource("Resource_wdp3h")])
text = "Fires a shot every [Fire Delay] seconds dealing [Damage] damage at a range of [Range]m
While held, gradually accelerates to [Speed Multiplier] times the fire rate over [Speed Time]"