way too many changes to list, oops. big rewrite.
This commit is contained in:
BIN
Weapons/RocketLauncher/rocket_launcher.png
Normal file
BIN
Weapons/RocketLauncher/rocket_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
34
Weapons/RocketLauncher/rocket_launcher.png.import
Normal file
34
Weapons/RocketLauncher/rocket_launcher.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://by1y15lm0bppe"
|
||||
path="res://.godot/imported/rocket_launcher.png-46d46e1e1165d4d8f368275130d46ec7.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Weapons/RocketLauncher/rocket_launcher.png"
|
||||
dest_files=["res://.godot/imported/rocket_launcher.png-46d46e1e1165d4d8f368275130d46ec7.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
Weapons/RocketLauncher/target_icon.png
Normal file
BIN
Weapons/RocketLauncher/target_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
34
Weapons/RocketLauncher/target_icon.png.import
Normal file
34
Weapons/RocketLauncher/target_icon.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://hnfa76d6tdi"
|
||||
path="res://.godot/imported/target_icon.png-fdb073988a655736b50ac44c55c9a9e4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Weapons/RocketLauncher/target_icon.png"
|
||||
dest_files=["res://.godot/imported/target_icon.png-fdb073988a655736b50ac44c55c9a9e4.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
Weapons/RocketLauncher/target_icon.tscn
Normal file
12
Weapons/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://Weapons/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
Weapons/RocketLauncher/target_list.png
Normal file
BIN
Weapons/RocketLauncher/target_list.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
34
Weapons/RocketLauncher/target_list.png.import
Normal file
34
Weapons/RocketLauncher/target_list.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cc2umukpibmx1"
|
||||
path="res://.godot/imported/target_list.png-8dceb321dce44756cc7d567683ca010a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Weapons/RocketLauncher/target_list.png"
|
||||
dest_files=["res://.godot/imported/target_list.png-8dceb321dce44756cc7d567683ca010a.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
|
83
Weapons/RocketLauncher/weapon_rocket_launcher.gd
Normal file
83
Weapons/RocketLauncher/weapon_rocket_launcher.gd
Normal file
@ -0,0 +1,83 @@
|
||||
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[EnemyController] = []
|
||||
var target_icons: Array[Sprite3D] = []
|
||||
|
||||
|
||||
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] = []
|
||||
for target: EnemyController in targets:
|
||||
if is_instance_valid(target):
|
||||
target_list.append(target)
|
||||
targets = target_list
|
||||
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:
|
||||
#TODO: make it "rockets fired" not "targets"
|
||||
current_energy -= targets.size()
|
||||
energy_spent.emit(targets.size(), stats.energy_type)
|
||||
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
|
||||
var effect: Effect = Effect.new()
|
||||
effect.damage = damage
|
||||
projectile.effect = effect
|
||||
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
|
1
Weapons/RocketLauncher/weapon_rocket_launcher.gd.uid
Normal file
1
Weapons/RocketLauncher/weapon_rocket_launcher.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://cuxi02s34ohs
|
57
Weapons/RocketLauncher/weapon_rocket_launcher.tscn
Normal file
57
Weapons/RocketLauncher/weapon_rocket_launcher.tscn
Normal file
@ -0,0 +1,57 @@
|
||||
[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" uid="uid://cuxi02s34ohs" path="res://Weapons/RocketLauncher/weapon_rocket_launcher.gd" id="2_8x1tf"]
|
||||
[ext_resource type="PackedScene" uid="uid://p2vwo8ivben6" path="res://Projectiles/Rocket/rocket_projectile.tscn" id="2_lfuvh"]
|
||||
[ext_resource type="PackedScene" uid="uid://csufsbi64asau" path="res://Weapons/RocketLauncher/target_icon.tscn" id="3_2x5va"]
|
||||
[ext_resource type="Resource" uid="uid://d2yo07m2mp2mp" path="res://Weapons/RocketLauncher/weapon_stats.tres" id="3_i1hxj"]
|
||||
[ext_resource type="Texture2D" uid="uid://by1y15lm0bppe" path="res://Weapons/RocketLauncher/rocket_launcher.png" id="4_iygkf"]
|
||||
[ext_resource type="Texture2D" uid="uid://cc2umukpibmx1" path="res://Weapons/RocketLauncher/target_list.png" id="6_jlv88"]
|
||||
[ext_resource type="AudioStream" uid="uid://dknygn5eyuhxt" path="res://Audio/shot1.wav" id="8_genbv"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f4p4w"]
|
||||
resource_local_to_scene = true
|
||||
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")
|
||||
|
||||
[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"]
|
||||
visible = false
|
||||
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")
|
31
Weapons/RocketLauncher/weapon_stats.tres
Normal file
31
Weapons/RocketLauncher/weapon_stats.tres
Normal file
@ -0,0 +1,31 @@
|
||||
[gd_resource type="Resource" script_class="CardText" load_steps=7 format=3 uid="uid://d2yo07m2mp2mp"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://yjb0uv6og430" path="res://Scripts/Resources/stat_attribute.gd" id="1_5gy7w"]
|
||||
[ext_resource type="Script" uid="uid://dg7gxxqfqxcmc" 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 = 12.0
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_ow0r7")
|
||||
target_type = 0
|
||||
energy_type = 1
|
||||
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