Refactor Part II
This commit is contained in:
parent
cd20f952ce
commit
3f99f1b8dd
56 changed files with 193 additions and 168 deletions
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bxdatd1ilfgmc"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bxdatd1ilfgmc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://systems/weapon_system/weapon_substate_machine.gd" id="1_krsgt"]
|
||||
[ext_resource type="Script" uid="uid://rx78vdadldm7" path="res://weapons/bomb/bomb_main_state.gd" id="2_870cc"]
|
||||
[ext_resource type="PackedScene" uid="uid://dtbpyfdawb02b" path="res://weapons/bomb/active_bomb.tscn" id="2_j5dxu"]
|
||||
[ext_resource type="Script" uid="uid://cx7j3kr1laq3s" path="res://weapons/bomb/bomb_idle_state.gd" id="3_1x0so"]
|
||||
[ext_resource type="Script" uid="uid://dmyir46aricwi" path="res://weapons/bomb/bomb_intro_state.gd" id="4_fv3ha"]
|
||||
[ext_resource type="Script" uid="uid://b5eapvgoni1pj" path="res://weapons/bomb/bomb_dropper.gd" id="5_fv3ha"]
|
||||
|
|
@ -21,6 +22,7 @@ metadata/_custom_type_script = "uid://e6lqknfl4ngt"
|
|||
|
||||
[node name="Plant" type="Node" parent="."]
|
||||
script = ExtResource("2_870cc")
|
||||
bomb_scene = ExtResource("2_j5dxu")
|
||||
|
||||
[node name="Idle" type="Node" parent="."]
|
||||
script = ExtResource("3_1x0so")
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ func exit() -> void:
|
|||
func on_animation_finished(animation):
|
||||
if animation == with_morphems("reload"):
|
||||
if machine.remaining_ammo > machine.max_ammo:
|
||||
machine.remaining_ammo -= machine.max_ammo-machine.ammo
|
||||
machine.ammo = machine.max_ammo
|
||||
machine.remaining_ammo -= machine.max_ammo
|
||||
else:
|
||||
machine.ammo = machine.remaining_ammo
|
||||
machine.remaining_ammo = 0
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://djwjl8xll53vn"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://djwjl8xll53vn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://systems/weapon_system/weapon_substate_machine.gd" id="1_g7s1i"]
|
||||
[ext_resource type="Script" uid="uid://ofv4e3dsfe8" path="res://weapons/gun/idle_state.gd" id="2_cmn6f"]
|
||||
|
|
@ -18,6 +18,14 @@ _limits = [-0.02, 0.02, 0.0, 20.0]
|
|||
_data = [Vector2(0, -9.313226e-10), 0.0, 0.0, 0, 0, Vector2(4.959569, 0.0044327714), 0.0, 0.0, 0, 0, Vector2(9.919138, -0.0075840354), 0.0, 0.0, 0, 0, Vector2(15.09434, 0.011533612), 0.0, 0.0, 0, 0, Vector2(20, -0.014684878), 0.0, 0.0, 0, 0]
|
||||
point_count = 5
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_bwg3m"]
|
||||
properties/0/path = NodePath(".:ammo")
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 2
|
||||
properties/1/path = NodePath(".:remaining_ammo")
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 2
|
||||
|
||||
[node name="StartingPistol" type="Node" node_paths=PackedStringArray("enter_state")]
|
||||
script = ExtResource("1_g7s1i")
|
||||
animation_prefix = &"baked_sp_"
|
||||
|
|
@ -52,3 +60,6 @@ emptyable = true
|
|||
[node name="FireTimer" type="Timer" parent="."]
|
||||
wait_time = 0.15
|
||||
one_shot = true
|
||||
|
||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_bwg3m")
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ var contacts: int = 0
|
|||
func _on_body_entered(_body: Node) -> void:
|
||||
contacts += 1
|
||||
if contacts > 2:
|
||||
var grenade = load("res://scenes/projectiles/molikman/molikman_molotov_fire.tscn").instantiate()
|
||||
Session.dynamic_objects_parent.add_child(grenade,true)
|
||||
grenade.global_position = global_position
|
||||
var fire = preload("uid://l4t1mflutm3t").instantiate()
|
||||
Session.dynamic_objects_parent.add_child(fire,true)
|
||||
fire.global_position = global_position
|
||||
queue_free()
|
||||
|
|
|
|||
38
weapons/molikman/molik/molik.tscn
Normal file
38
weapons/molikman/molik/molik.tscn
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://b6qahd6q60js7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://y1s64ppporww" path="res://weapons/molikman/molik/molik.gd" id="1_aqokr"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_aqokr"]
|
||||
bounce = 0.53
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_fwcyt"]
|
||||
radius = 0.05
|
||||
height = 0.1
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_aqokr"]
|
||||
radius = 0.05
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_6ic6f"]
|
||||
properties/0/path = NodePath(".:position")
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 1
|
||||
|
||||
[node name="Molik" type="RigidBody3D"]
|
||||
collision_layer = 8
|
||||
physics_material_override = SubResource("PhysicsMaterial_aqokr")
|
||||
gravity_scale = 0.25
|
||||
continuous_cd = true
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 2
|
||||
script = ExtResource("1_aqokr")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_fwcyt")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("SphereShape3D_aqokr")
|
||||
|
||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_6ic6f")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
35
weapons/molikman/molik/molikman_molik.tscn
Normal file
35
weapons/molikman/molik/molikman_molik.tscn
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://c5q7e5dj86187"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://systems/weapon_system/weapon_substate_machine.gd" id="1_e53aq"]
|
||||
[ext_resource type="Script" uid="uid://js2rkse5mka0" path="res://weapons/molikman/molik/intro_state.gd" id="2_8q75j"]
|
||||
[ext_resource type="Script" uid="uid://cnre3f01a2n88" path="res://weapons/molikman/molik/idle_state.gd" id="3_p1i4u"]
|
||||
[ext_resource type="Script" uid="uid://b6eio68csxw7v" path="res://weapons/molikman/molik/throw.gd" id="4_1la3w"]
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_i1uig"]
|
||||
properties/0/path = NodePath(".:ammo")
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 1
|
||||
properties/1/path = NodePath(".:remaining_ammo")
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 1
|
||||
|
||||
[node name="MolikmanMolik" type="Node" node_paths=PackedStringArray("enter_state")]
|
||||
script = ExtResource("1_e53aq")
|
||||
animation_prefix = &"baked_sp_"
|
||||
visibility_target = &"sp"
|
||||
max_ammo = 3
|
||||
ammo_mags = 0
|
||||
enter_state = NodePath("Intro")
|
||||
metadata/_custom_type_script = "uid://e6lqknfl4ngt"
|
||||
|
||||
[node name="Intro" type="Node" parent="."]
|
||||
script = ExtResource("2_8q75j")
|
||||
|
||||
[node name="Idle" type="Node" parent="."]
|
||||
script = ExtResource("3_p1i4u")
|
||||
|
||||
[node name="Throw" type="Node" parent="."]
|
||||
script = ExtResource("4_1la3w")
|
||||
|
||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_i1uig")
|
||||
24
weapons/molikman/molik/molikman_molotov_fire.gd
Normal file
24
weapons/molikman/molik/molikman_molotov_fire.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extends Area3D
|
||||
|
||||
@export var dps: float
|
||||
@export var damage_timer: Timer
|
||||
|
||||
var damage_targets: Array[Player]
|
||||
|
||||
func _ready() -> void:
|
||||
body_entered.connect(on_body_entered)
|
||||
body_exited.connect(on_body_exited)
|
||||
|
||||
func damage():
|
||||
for target in damage_targets:
|
||||
if target.is_on_floor():
|
||||
target.take_damage(int(dps*damage_timer.wait_time))
|
||||
|
||||
func on_body_entered(body: Node3D):
|
||||
|
||||
if body is Player:
|
||||
damage_targets.append(body)
|
||||
|
||||
func on_body_exited(body: Node3D):
|
||||
if body is Player:
|
||||
damage_targets.erase(body)
|
||||
1
weapons/molikman/molik/molikman_molotov_fire.gd.uid
Normal file
1
weapons/molikman/molik/molikman_molotov_fire.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bo0ij4miuksua
|
||||
77
weapons/molikman/molik/molikman_molotov_fire.tscn
Normal file
77
weapons/molikman/molik/molikman_molotov_fire.tscn
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://l4t1mflutm3t"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bmnqvop2dy5pm" path="res://textures/prototype_yellow_256x256.png" id="1_hr7p8"]
|
||||
[ext_resource type="Script" uid="uid://bo0ij4miuksua" path="res://weapons/molikman/molik/molikman_molotov_fire.gd" id="1_qokq0"]
|
||||
[ext_resource type="Texture2D" uid="uid://b8aqstr5es5x4" path="res://textures/prototype_orange_256x256.png" id="2_qokq0"]
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_hr7p8"]
|
||||
height = 3.0
|
||||
radius = 1.5
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_hr7p8"]
|
||||
colors = PackedColorArray(1, 0.53333336, 0, 1, 0.45, 0.45, 0.45, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_qokq0"]
|
||||
gradient = SubResource("Gradient_hr7p8")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_hr7p8"]
|
||||
emission_shape_scale = Vector3(1.5, 1.5, 1.5)
|
||||
emission_shape = 1
|
||||
emission_sphere_radius = 1.0
|
||||
direction = Vector3(0, 1, 0)
|
||||
initial_velocity_max = 3.4499998
|
||||
orbit_velocity_min = -0.46899992
|
||||
orbit_velocity_max = 0.4130001
|
||||
gravity = Vector3(0, 0, 0)
|
||||
tangential_accel_min = -3.4500022
|
||||
tangential_accel_max = 2.0699978
|
||||
color_ramp = SubResource("GradientTexture1D_qokq0")
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_qokq0"]
|
||||
|
||||
[sub_resource type="TextMesh" id="TextMesh_33jv6"]
|
||||
material = SubResource("StandardMaterial3D_qokq0")
|
||||
text = "fire"
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_ykxjp"]
|
||||
properties/0/path = NodePath(".:position")
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 1
|
||||
|
||||
[node name="MolikmanMolotovFire" type="Area3D" node_paths=PackedStringArray("damage_timer")]
|
||||
collision_layer = 8
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_qokq0")
|
||||
dps = 25.0
|
||||
damage_timer = NodePath("DamageTimer")
|
||||
|
||||
[node name="Decal" type="Decal" parent="."]
|
||||
size = Vector3(3, 3, 3)
|
||||
texture_albedo = ExtResource("1_hr7p8")
|
||||
texture_emission = ExtResource("2_qokq0")
|
||||
emission_energy = 0.25
|
||||
cull_mask = 1048572
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("CylinderShape3D_hr7p8")
|
||||
|
||||
[node name="GPUParticles3D" type="GPUParticles3D" parent="."]
|
||||
amount = 16
|
||||
transform_align = 1
|
||||
process_material = SubResource("ParticleProcessMaterial_hr7p8")
|
||||
draw_pass_1 = SubResource("TextMesh_33jv6")
|
||||
|
||||
[node name="DieTimer" type="Timer" parent="."]
|
||||
wait_time = 15.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="DamageTimer" type="Timer" parent="."]
|
||||
wait_time = 0.25
|
||||
autostart = true
|
||||
|
||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_ykxjp")
|
||||
|
||||
[connection signal="timeout" from="DieTimer" to="." method="queue_free"]
|
||||
[connection signal="timeout" from="DamageTimer" to="." method="damage"]
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
extends WeaponState
|
||||
|
||||
const molik: PackedScene = preload("res://scenes/weapons/molik.tscn")
|
||||
const molik: PackedScene = preload("uid://b6qahd6q60js7")
|
||||
|
||||
func enter() -> void:
|
||||
fire()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[ext_resource type="Texture2D" uid="uid://bmnqvop2dy5pm" path="res://textures/prototype_yellow_256x256.png" id="1_hmyxe"]
|
||||
[ext_resource type="Script" uid="uid://bvnn2eiwqbu7t" path="res://systems/weapon_system/weapon_resource.gd" id="1_ktfgd"]
|
||||
[ext_resource type="PackedScene" uid="uid://c5q7e5dj86187" path="res://scenes/weapons/molikman_molik.tscn" id="3_6mu31"]
|
||||
[ext_resource type="PackedScene" uid="uid://c5q7e5dj86187" path="res://weapons/molikman/molik/molikman_molik.tscn" id="3_6mu31"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ktfgd")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue