enabled enforced static typing
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
[gd_resource type="Resource" script_class="Card" load_steps=6 format=3 uid="uid://b37r54q84vqoi"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_ly0o5"]
|
||||
[ext_resource type="Resource" uid="uid://c65rq455ma8f6" path="res://PCs/Mechanic/ClassCards/RocketLauncher/tower_stats.tres" id="3_06my6"]
|
||||
[ext_resource type="PackedScene" uid="uid://bdp7icdejayvr" path="res://PCs/Mechanic/ClassCards/RocketLauncher/weapon_rocket_launcher.tscn" id="3_qo5gv"]
|
||||
[ext_resource type="Resource" uid="uid://d2yo07m2mp2mp" path="res://PCs/Mechanic/ClassCards/RocketLauncher/weapon_stats.tres" id="4_cmvfg"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3q0f6w30nwsh" path="res://PCs/Mechanic/ClassCards/RocketLauncher/tower_rocket_launcher.tscn" id="4_hff2k"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ly0o5")
|
||||
rarity = 0
|
||||
faction = 0
|
||||
turret_scene = ExtResource("4_hff2k")
|
||||
weapon_scene = ExtResource("3_qo5gv")
|
||||
weapon_stats = ExtResource("4_cmvfg")
|
||||
tower_stats = ExtResource("3_06my6")
|
||||
display_name = "Rocket Launcher"
|
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket.png
Normal file
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 835 B |
34
PCs/Mechanic/ClassCards/RocketLauncher/rocket.png.import
Normal file
34
PCs/Mechanic/ClassCards/RocketLauncher/rocket.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bode8mfmr3r1h"
|
||||
path="res://.godot/imported/rocket.png-77edbc49fe71a63a62ed874f90d7b439.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Mechanic/ClassCards/RocketLauncher/rocket.png"
|
||||
dest_files=["res://.godot/imported/rocket.png-77edbc49fe71a63a62ed874f90d7b439.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
|
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket.png.kra
Normal file
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket.png.kra
Normal file
Binary file not shown.
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher.glb
Normal file
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher.glb
Normal file
Binary file not shown.
@ -0,0 +1,47 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://buyx8g4vlh7g7"
|
||||
path="res://.godot/imported/rocket_launcher.glb-37982edba72c4d23ecb61dd773429a36.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher.glb"
|
||||
dest_files=["res://.godot/imported/rocket_launcher.glb-37982edba72c4d23ecb61dd773429a36.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type="Node3D"
|
||||
nodes/root_name="Scene Root"
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
import_script/path=""
|
||||
_subresources={
|
||||
"meshes": {
|
||||
"rocket_launcher_Cube": {
|
||||
"generate/lightmap_uv": 0,
|
||||
"generate/lods": 0,
|
||||
"generate/shadow_meshes": 0,
|
||||
"lods/normal_merge_angle": 60.0,
|
||||
"lods/normal_split_angle": 25.0,
|
||||
"save_to_file/enabled": false,
|
||||
"save_to_file/make_streamable": "",
|
||||
"save_to_file/path": "res://rocket_launcher_model.res"
|
||||
}
|
||||
}
|
||||
}
|
||||
gltf/naming_version=0
|
||||
gltf/embedded_image_handling=1
|
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher.png
Normal file
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://by1y15lm0bppe"
|
||||
path="res://.godot/imported/rocket_launcher.png-89f364514f7ef0b363fc8ad5d17ac350.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher.png"
|
||||
dest_files=["res://.godot/imported/rocket_launcher.png-89f364514f7ef0b363fc8ad5d17ac350.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
|
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher_model.res
Normal file
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher_model.res
Normal file
Binary file not shown.
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher_tex.png
Normal file
BIN
PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher_tex.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cwou52extvihw"
|
||||
path="res://.godot/imported/rocket_launcher_tex.png-2047ab318b8a45520e5c36182b4b8678.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher_tex.png"
|
||||
dest_files=["res://.godot/imported/rocket_launcher_tex.png-2047ab318b8a45520e5c36182b4b8678.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
|
@ -0,0 +1 @@
|
||||
class_name RocketProjectile extends HomingProjectile
|
@ -0,0 +1,22 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://p2vwo8ivben6"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://di2wwvkv4wov1" path="res://Scenes/Projectiles/homing_projectile.tscn" id="1_fnn4i"]
|
||||
[ext_resource type="Script" path="res://PCs/Mechanic/ClassCards/RocketLauncher/rocket_projectile.gd" id="2_86up0"]
|
||||
[ext_resource type="Texture2D" uid="uid://bode8mfmr3r1h" path="res://PCs/Mechanic/ClassCards/RocketLauncher/rocket.png" id="3_aonkx"]
|
||||
[ext_resource type="AudioStream" uid="uid://n0w2kj5j2x4e" path="res://PCs/Mechanic/ClassCards/RocketLauncher/shot1.wav" id="4_i5kff"]
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_4rf40"]
|
||||
random_pitch = 1.1
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("4_i5kff")
|
||||
stream_0/weight = 1.0
|
||||
|
||||
[node name="Rocket" instance=ExtResource("1_fnn4i")]
|
||||
script = ExtResource("2_86up0")
|
||||
|
||||
[node name="Sprite3D" parent="." index="1"]
|
||||
pixel_size = 0.013
|
||||
texture = ExtResource("3_aonkx")
|
||||
|
||||
[node name="AudioStreamPlayer" parent="." index="2"]
|
||||
stream = SubResource("AudioStreamRandomizer_4rf40")
|
BIN
PCs/Mechanic/ClassCards/RocketLauncher/shot1.wav
Normal file
BIN
PCs/Mechanic/ClassCards/RocketLauncher/shot1.wav
Normal file
Binary file not shown.
24
PCs/Mechanic/ClassCards/RocketLauncher/shot1.wav.import
Normal file
24
PCs/Mechanic/ClassCards/RocketLauncher/shot1.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://n0w2kj5j2x4e"
|
||||
path="res://.godot/imported/shot1.wav-ab82584ca2f5abc15cd1c0910b64615e.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Mechanic/ClassCards/RocketLauncher/shot1.wav"
|
||||
dest_files=["res://.godot/imported/shot1.wav-ab82584ca2f5abc15cd1c0910b64615e.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
BIN
PCs/Mechanic/ClassCards/RocketLauncher/target_icon.png
Normal file
BIN
PCs/Mechanic/ClassCards/RocketLauncher/target_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://hnfa76d6tdi"
|
||||
path="res://.godot/imported/target_icon.png-88a8c3cbac1c3c0f8fa9cc14c20caa64.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Mechanic/ClassCards/RocketLauncher/target_icon.png"
|
||||
dest_files=["res://.godot/imported/target_icon.png-88a8c3cbac1c3c0f8fa9cc14c20caa64.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
|
12
PCs/Mechanic/ClassCards/RocketLauncher/target_icon.tscn
Normal file
12
PCs/Mechanic/ClassCards/RocketLauncher/target_icon.tscn
Normal file
@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://csufsbi64asau"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://hnfa76d6tdi" path="res://PCs/Mechanic/ClassCards/RocketLauncher/target_icon.png" id="1_r4a3f"]
|
||||
|
||||
[node name="Node3D" type="Sprite3D"]
|
||||
sorting_offset = 20.0
|
||||
pixel_size = 0.002
|
||||
billboard = 1
|
||||
no_depth_test = true
|
||||
fixed_size = true
|
||||
texture_filter = 0
|
||||
texture = ExtResource("1_r4a3f")
|
BIN
PCs/Mechanic/ClassCards/RocketLauncher/target_list.png
Normal file
BIN
PCs/Mechanic/ClassCards/RocketLauncher/target_list.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cc2umukpibmx1"
|
||||
path="res://.godot/imported/target_list.png-22916b59d069390b66a4bbdfb4754966.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://PCs/Mechanic/ClassCards/RocketLauncher/target_list.png"
|
||||
dest_files=["res://.godot/imported/target_list.png-22916b59d069390b66a4bbdfb4754966.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=1
|
@ -0,0 +1,74 @@
|
||||
class_name RocketLauncherTower extends ProjectileTower
|
||||
|
||||
var target_max: float = 3
|
||||
var targets: Array = []
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
target_max = floori(stats.get_attribute("Target Limit"))
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if !is_multiplayer_authority():
|
||||
#only doing the graphical sort of stuff but not shoot logic
|
||||
if targeted_enemy and is_instance_valid(targeted_enemy):
|
||||
if !targeted_enemy.alive or global_position.distance_to(targeted_enemy.global_position) > target_range:
|
||||
targeted_enemy = null
|
||||
else:
|
||||
aim()
|
||||
return
|
||||
if targets.size() < target_max:
|
||||
acquire_target()
|
||||
if targets.size() > 0:
|
||||
var target_list: Array[EnemyController] = targets.duplicate()
|
||||
for target: EnemyController in target_list:
|
||||
if !is_instance_valid(target) or !target.alive:
|
||||
targets.erase(target)
|
||||
continue
|
||||
if global_position.distance_to(target.global_position) > target_range:
|
||||
targets.erase(target)
|
||||
if targets.size() > 0:
|
||||
targeted_enemy = targets[0]
|
||||
networked_acquire_target.rpc(get_tree().root.get_path_to(targeted_enemy))
|
||||
aim()
|
||||
if time_since_firing >= time_between_shots:
|
||||
time_since_firing -= time_between_shots
|
||||
shoot()
|
||||
|
||||
|
||||
func acquire_target() -> void:
|
||||
var possible_enemies: Array[EnemyController] = []
|
||||
for enemy: EnemyController in get_tree().get_nodes_in_group("Enemies"):
|
||||
if global_position.distance_to(enemy.global_position) > target_range:
|
||||
continue
|
||||
if !(enemy.stats.target_type & stats.target_type):
|
||||
continue
|
||||
if targets.has(enemy):
|
||||
continue
|
||||
possible_enemies.append(enemy)
|
||||
|
||||
for x: int in target_max - targets.size():
|
||||
if possible_enemies.size() == 0:
|
||||
return
|
||||
var chosen: EnemyController = possible_enemies.pick_random()
|
||||
possible_enemies.erase(chosen)
|
||||
targets.append(chosen)
|
||||
|
||||
|
||||
func shoot() -> void:
|
||||
for target: EnemyController in targets:
|
||||
networked_spawn_rocket.rpc(get_tree().root.get_path_to(target), multiplayer.get_unique_id())
|
||||
|
||||
|
||||
@rpc("reliable", "call_local")
|
||||
func networked_spawn_rocket(target_node_path: String, peer_id: int) -> void:
|
||||
var target: EnemyController = get_tree().root.get_node(target_node_path)
|
||||
var projectile: RocketProjectile = projectile_scene.instantiate() as RocketProjectile
|
||||
projectile.position = global_position + Vector3.UP
|
||||
projectile.damage = damage
|
||||
projectile.target = target
|
||||
projectile.name = base_name + str(peer_id) + str(projectile_id)
|
||||
get_tree().root.add_child(projectile)
|
||||
projectile.apply_central_impulse(Vector3.UP * 3.0)
|
||||
projectile_id += 1
|
@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://b3q0f6w30nwsh"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://t0b32qb8eub2" path="res://Scenes/Towers/projectile_tower.tscn" id="1_su4lx"]
|
||||
[ext_resource type="Script" path="res://PCs/Mechanic/ClassCards/RocketLauncher/tower_rocket_launcher.gd" id="2_33124"]
|
||||
[ext_resource type="PackedScene" uid="uid://p2vwo8ivben6" path="res://PCs/Mechanic/ClassCards/RocketLauncher/rocket_projectile.tscn" id="3_8kvhb"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://dltxsh8ppubj3" path="res://PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher_model.res" id="4_1rycx"]
|
||||
[ext_resource type="AudioStream" uid="uid://n0w2kj5j2x4e" path="res://PCs/Mechanic/ClassCards/RocketLauncher/shot1.wav" id="5_nd3i8"]
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_7k8gw"]
|
||||
random_pitch = 1.1
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("5_nd3i8")
|
||||
stream_0/weight = 1.0
|
||||
|
||||
[node name="RocketLauncherTower" instance=ExtResource("1_su4lx")]
|
||||
script = ExtResource("2_33124")
|
||||
projectile_scene = ExtResource("3_8kvhb")
|
||||
|
||||
[node name="Pitch" parent="." index="1"]
|
||||
visible = false
|
||||
|
||||
[node name="Yaw" parent="." index="2"]
|
||||
transform = Transform3D(0.4, 0, 0, 0, 0.4, 0, 0, 0, 0.4, 0, 0.667653, 0)
|
||||
mesh = ExtResource("4_1rycx")
|
||||
|
||||
[node name="AudioStreamPlayer3D" parent="Yaw" index="0"]
|
||||
stream = SubResource("AudioStreamRandomizer_7k8gw")
|
30
PCs/Mechanic/ClassCards/RocketLauncher/tower_stats.tres
Normal file
30
PCs/Mechanic/ClassCards/RocketLauncher/tower_stats.tres
Normal file
@ -0,0 +1,30 @@
|
||||
[gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://c65rq455ma8f6"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_jajj0"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="2_lag26"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_4fjm2"]
|
||||
script = ExtResource("1_jajj0")
|
||||
key = "Fire Delay"
|
||||
value = 5.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_uwj4j"]
|
||||
script = ExtResource("1_jajj0")
|
||||
key = "Target Limit"
|
||||
value = 3.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6qv5v"]
|
||||
script = ExtResource("1_jajj0")
|
||||
key = "Damage"
|
||||
value = 8.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_y1rtq"]
|
||||
script = ExtResource("1_jajj0")
|
||||
key = "Range"
|
||||
value = 20.0
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_lag26")
|
||||
target_type = 2
|
||||
attributes = Array[ExtResource("1_jajj0")]([SubResource("Resource_4fjm2"), SubResource("Resource_uwj4j"), SubResource("Resource_6qv5v"), SubResource("Resource_y1rtq")])
|
||||
text = "Every /Fire Delay\\s, fires a homing rocket at up to /Target Limit\\ flying enemies up to /Range\\m away that deal /Damage\\ damage"
|
@ -0,0 +1,81 @@
|
||||
class_name RocketLauncherWeapon extends ProjectileWeapon
|
||||
|
||||
@export var target_icon_scene: PackedScene
|
||||
@export var targeting_raycast: RayCast3D
|
||||
@export var targeting_ui_rect: TextureRect
|
||||
|
||||
var target_max: int = 3
|
||||
var targets: Array = []
|
||||
var target_icons: Array = []
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
targeting_raycast.global_position = hero.camera.global_position
|
||||
|
||||
target_max = floori(stats.get_attribute("Target Limit"))
|
||||
for x: int in target_max:
|
||||
var icon: Sprite3D = target_icon_scene.instantiate()
|
||||
add_child(icon)
|
||||
icon.set_visible(false)
|
||||
target_icons.append(icon)
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
if !trigger_held or time_since_firing < time_between_shots or current_energy < energy_cost:
|
||||
return
|
||||
var target_list: Array[EnemyController] = targets.duplicate()
|
||||
for target: EnemyController in target_list:
|
||||
if !is_instance_valid(target):
|
||||
targets.erase(target)
|
||||
continue
|
||||
for x: int in target_icons.size():
|
||||
if x < targets.size():
|
||||
target_icons[x].global_position = targets[x].sprite.global_position
|
||||
target_icons[x].set_visible(true)
|
||||
else:
|
||||
target_icons[x].set_visible(false)
|
||||
targeting_ui_rect.set_visible(true)
|
||||
targeting_ui_rect.texture.region = Rect2(128 * targets.size(), 0, 128, 128)
|
||||
if targets.size() < target_max and targeting_raycast.is_colliding() and !targets.has(targeting_raycast.get_collider()):
|
||||
targets.append(targeting_raycast.get_collider())
|
||||
|
||||
|
||||
func release_trigger() -> void:
|
||||
super.release_trigger()
|
||||
if targets.size() > 0 and current_energy >= energy_cost and time_since_firing >= time_between_shots:
|
||||
current_energy -= energy_cost
|
||||
energy_changed.emit(current_energy)
|
||||
time_since_firing -= time_between_shots
|
||||
shoot()
|
||||
|
||||
|
||||
func shoot() -> void:
|
||||
animator.play("shoot")
|
||||
recharging = false
|
||||
recharge_speed = 0.0
|
||||
for target: EnemyController in targets:
|
||||
networked_spawn_rocket.rpc(get_tree().root.get_path_to(target), multiplayer.get_unique_id())
|
||||
targets.clear()
|
||||
targeting_ui_rect.set_visible(false)
|
||||
for icon: Sprite3D in target_icons:
|
||||
icon.set_visible(false)
|
||||
|
||||
|
||||
@rpc("reliable", "call_local")
|
||||
func networked_spawn_rocket(target_node_path: String, peer_id: int) -> void:
|
||||
var target: EnemyController = get_tree().root.get_node(target_node_path)
|
||||
var projectile: RocketProjectile = projectile_scene.instantiate() as RocketProjectile
|
||||
projectile.position = global_position
|
||||
projectile.damage = damage
|
||||
projectile.target = target
|
||||
projectile.owner_id = peer_id
|
||||
projectile.name = str(peer_id) + str(projectile_id)
|
||||
get_tree().root.add_child(projectile)
|
||||
projectile.apply_central_impulse(Vector3.UP * 3.0)
|
||||
projectile_id += 1
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
pass
|
@ -0,0 +1,56 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://bdp7icdejayvr"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bqdllitxbbpyp" path="res://Scenes/Weapons/projectile_weapon.tscn" id="1_gxaua"]
|
||||
[ext_resource type="Script" path="res://PCs/Mechanic/ClassCards/RocketLauncher/weapon_rocket_launcher.gd" id="2_8x1tf"]
|
||||
[ext_resource type="PackedScene" uid="uid://p2vwo8ivben6" path="res://PCs/Mechanic/ClassCards/RocketLauncher/rocket_projectile.tscn" id="2_lfuvh"]
|
||||
[ext_resource type="PackedScene" uid="uid://csufsbi64asau" path="res://PCs/Mechanic/ClassCards/RocketLauncher/target_icon.tscn" id="3_2x5va"]
|
||||
[ext_resource type="Resource" uid="uid://d2yo07m2mp2mp" path="res://PCs/Mechanic/ClassCards/RocketLauncher/weapon_stats.tres" id="3_i1hxj"]
|
||||
[ext_resource type="Texture2D" uid="uid://by1y15lm0bppe" path="res://PCs/Mechanic/ClassCards/RocketLauncher/rocket_launcher.png" id="4_iygkf"]
|
||||
[ext_resource type="Texture2D" uid="uid://cc2umukpibmx1" path="res://PCs/Mechanic/ClassCards/RocketLauncher/target_list.png" id="6_jlv88"]
|
||||
[ext_resource type="AudioStream" uid="uid://n0w2kj5j2x4e" path="res://PCs/Mechanic/ClassCards/RocketLauncher/shot1.wav" id="8_genbv"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f4p4w"]
|
||||
atlas = ExtResource("4_iygkf")
|
||||
region = Rect2(0, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ewxon"]
|
||||
atlas = ExtResource("6_jlv88")
|
||||
region = Rect2(0, 0, 128, 128)
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_5w2i3"]
|
||||
random_pitch = 1.1
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("8_genbv")
|
||||
stream_0/weight = 1.0
|
||||
|
||||
[node name="RocketLauncher" node_paths=PackedStringArray("targeting_raycast", "targeting_ui_rect") instance=ExtResource("1_gxaua")]
|
||||
script = ExtResource("2_8x1tf")
|
||||
target_icon_scene = ExtResource("3_2x5va")
|
||||
targeting_raycast = NodePath("RayCast3D")
|
||||
targeting_ui_rect = NodePath("TextureRect")
|
||||
projectile_scene = ExtResource("2_lfuvh")
|
||||
stats = ExtResource("3_i1hxj")
|
||||
|
||||
[node name="Sprite3D" parent="." index="0"]
|
||||
texture = SubResource("AtlasTexture_f4p4w")
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="." index="2"]
|
||||
target_position = Vector3(0, 0, -100)
|
||||
collision_mask = 4
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="." index="3"]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = SubResource("AtlasTexture_ewxon")
|
||||
|
||||
[node name="AudioStreamPlayer3D" parent="." index="5"]
|
||||
stream = SubResource("AudioStreamRandomizer_5w2i3")
|
30
PCs/Mechanic/ClassCards/RocketLauncher/weapon_stats.tres
Normal file
30
PCs/Mechanic/ClassCards/RocketLauncher/weapon_stats.tres
Normal file
@ -0,0 +1,30 @@
|
||||
[gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://d2yo07m2mp2mp"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/stat_attribute.gd" id="1_5gy7w"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/card_text.gd" id="2_ow0r7"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_4fjm2"]
|
||||
script = ExtResource("1_5gy7w")
|
||||
key = "Fire Delay"
|
||||
value = 2.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_uwj4j"]
|
||||
script = ExtResource("1_5gy7w")
|
||||
key = "Target Limit"
|
||||
value = 3.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6qv5v"]
|
||||
script = ExtResource("1_5gy7w")
|
||||
key = "Damage"
|
||||
value = 8.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ymyed"]
|
||||
script = ExtResource("1_5gy7w")
|
||||
key = "Energy"
|
||||
value = 30.0
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_ow0r7")
|
||||
target_type = 0
|
||||
attributes = Array[ExtResource("1_5gy7w")]([SubResource("Resource_4fjm2"), SubResource("Resource_uwj4j"), SubResource("Resource_6qv5v"), SubResource("Resource_ymyed")])
|
||||
text = "Every /Fire Delay\\s, hold to target up to /Target Limit\\ enemies and release to fire homing rockets that deal /Damage\\ damage"
|
Reference in New Issue
Block a user