Small refactor
This commit is contained in:
parent
82539c5af8
commit
c0489d405b
7 changed files with 11 additions and 15 deletions
|
|
@ -7572,6 +7572,7 @@ script = ExtResource("1_l07l8")
|
||||||
weapon_models = {
|
weapon_models = {
|
||||||
&"bomb": NodePath("Camera3D/molikman_hands/Armature"),
|
&"bomb": NodePath("Camera3D/molikman_hands/Armature"),
|
||||||
&"knife": NodePath("Camera3D/molikman_hands/Knife"),
|
&"knife": NodePath("Camera3D/molikman_hands/Knife"),
|
||||||
|
&"mm_molik": NodePath("Camera3D/molikman_hands/GunArm"),
|
||||||
&"sp": NodePath("Camera3D/molikman_hands/GunArm")
|
&"sp": NodePath("Camera3D/molikman_hands/GunArm")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@ extends SubStateMachine
|
||||||
class_name WeaponSubStateMachine
|
class_name WeaponSubStateMachine
|
||||||
|
|
||||||
@export var animation_prefix: StringName
|
@export var animation_prefix: StringName
|
||||||
@export var registry_entry: StringName
|
@export var weapon_gid: StringName
|
||||||
@export var visibility_target: StringName
|
|
||||||
|
|
||||||
@export var max_ammo: int
|
@export var max_ammo: int
|
||||||
@export var ammo: int = -1:
|
@export var ammo: int = -1:
|
||||||
|
|
@ -66,11 +65,11 @@ func _ready() -> void:
|
||||||
|
|
||||||
func _enter() -> void:
|
func _enter() -> void:
|
||||||
super()
|
super()
|
||||||
player.weapon_models[visibility_target].show()
|
player.weapon_models[weapon_gid].show()
|
||||||
|
|
||||||
func _exit() -> void:
|
func _exit() -> void:
|
||||||
super()
|
super()
|
||||||
player.weapon_models[visibility_target].hide()
|
player.weapon_models[weapon_gid].hide()
|
||||||
|
|
||||||
func use_begin() -> void:
|
func use_begin() -> void:
|
||||||
if current_state != null:
|
if current_state != null:
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ func get_empty_ability_slot() -> StringName:
|
||||||
|
|
||||||
func can_add_ability(ability: StringName, slot: StringName) -> bool:
|
func can_add_ability(ability: StringName, slot: StringName) -> bool:
|
||||||
for ability_slot in ["ability_first","ability_second","ability_third"]:
|
for ability_slot in ["ability_first","ability_second","ability_third"]:
|
||||||
if slots[ability_slot] != null and slots[ability_slot].registry_entry == ability:
|
if slots[ability_slot] != null and slots[ability_slot].weapon_gid == ability:
|
||||||
return false
|
return false
|
||||||
return can_add(slot)
|
return can_add(slot)
|
||||||
|
|
||||||
|
|
@ -116,7 +116,7 @@ func drop(weapon: WeaponSubStateMachine) -> void:
|
||||||
if slots.find_key(weapon) in ["knife","ability_first","ability_second","ability_third"]:
|
if slots.find_key(weapon) in ["knife","ability_first","ability_second","ability_third"]:
|
||||||
return
|
return
|
||||||
|
|
||||||
var dropped_weapon: DroppableWeapon = Registry.weapons[weapon.registry_entry].dropped_scene.instantiate()
|
var dropped_weapon: DroppableWeapon = Registry.weapons[weapon.weapon_gid].dropped_scene.instantiate()
|
||||||
dropped_weapon.weapon.ammo = weapon.ammo
|
dropped_weapon.weapon.ammo = weapon.ammo
|
||||||
dropped_weapon.weapon.remaining_ammo = weapon.remaining_ammo
|
dropped_weapon.weapon.remaining_ammo = weapon.remaining_ammo
|
||||||
dropped_weapon.weapon.slot = weapon.slot
|
dropped_weapon.weapon.slot = weapon.slot
|
||||||
|
|
@ -172,7 +172,7 @@ func notify_slots_updated():
|
||||||
if slots[key] == null:
|
if slots[key] == null:
|
||||||
display_slots[key] = ""
|
display_slots[key] = ""
|
||||||
else:
|
else:
|
||||||
display_slots[key] = slots[key].registry_entry
|
display_slots[key] = slots[key].weapon_gid
|
||||||
var current_slot: StringName = ""
|
var current_slot: StringName = ""
|
||||||
var found = slots.find_key(current_state)
|
var found = slots.find_key(current_state)
|
||||||
if found:
|
if found:
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,7 @@
|
||||||
[node name="Bomb" type="Node" node_paths=PackedStringArray("enter_state")]
|
[node name="Bomb" type="Node" node_paths=PackedStringArray("enter_state")]
|
||||||
script = ExtResource("1_krsgt")
|
script = ExtResource("1_krsgt")
|
||||||
animation_prefix = &"baked_bomb_"
|
animation_prefix = &"baked_bomb_"
|
||||||
registry_entry = &"bomb"
|
weapon_gid = &"bomb"
|
||||||
visibility_target = &"bomb"
|
|
||||||
max_ammo = 1
|
max_ammo = 1
|
||||||
ammo_mags = 0
|
ammo_mags = 0
|
||||||
can_be_previous = false
|
can_be_previous = false
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@ properties/1/replication_mode = 2
|
||||||
[node name="StartingPistol" type="Node" node_paths=PackedStringArray("enter_state")]
|
[node name="StartingPistol" type="Node" node_paths=PackedStringArray("enter_state")]
|
||||||
script = ExtResource("1_g7s1i")
|
script = ExtResource("1_g7s1i")
|
||||||
animation_prefix = &"baked_sp_"
|
animation_prefix = &"baked_sp_"
|
||||||
registry_entry = &"sp"
|
weapon_gid = &"sp"
|
||||||
visibility_target = &"sp"
|
|
||||||
max_ammo = 20
|
max_ammo = 20
|
||||||
speed_modifier = 0.9
|
speed_modifier = 0.9
|
||||||
slot = &"secondary"
|
slot = &"secondary"
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@
|
||||||
[node name="Knife" type="Node" node_paths=PackedStringArray("enter_state")]
|
[node name="Knife" type="Node" node_paths=PackedStringArray("enter_state")]
|
||||||
script = ExtResource("1_2xf1r")
|
script = ExtResource("1_2xf1r")
|
||||||
animation_prefix = &"baked_knife_"
|
animation_prefix = &"baked_knife_"
|
||||||
registry_entry = &"knife"
|
weapon_gid = &"knife"
|
||||||
visibility_target = &"knife"
|
|
||||||
ammo_mags = 0
|
ammo_mags = 0
|
||||||
slot = &"knife"
|
slot = &"knife"
|
||||||
enter_state = NodePath("Intro")
|
enter_state = NodePath("Intro")
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ properties/1/replication_mode = 1
|
||||||
[node name="MolikmanMolik" type="Node" node_paths=PackedStringArray("enter_state")]
|
[node name="MolikmanMolik" type="Node" node_paths=PackedStringArray("enter_state")]
|
||||||
script = ExtResource("1_e53aq")
|
script = ExtResource("1_e53aq")
|
||||||
animation_prefix = &"baked_sp_"
|
animation_prefix = &"baked_sp_"
|
||||||
registry_entry = &"mm_molik"
|
weapon_gid = &"mm_molik"
|
||||||
visibility_target = &"sp"
|
|
||||||
max_ammo = 1
|
max_ammo = 1
|
||||||
ammo_mags = 0
|
ammo_mags = 0
|
||||||
speed_modifier = 0.9
|
speed_modifier = 0.9
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue