Fixed annoying error
This commit is contained in:
parent
100afe5e51
commit
aa1c1c8d64
8 changed files with 38 additions and 49 deletions
|
|
@ -119,7 +119,7 @@ spawn_radius = 10.0
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -32.38732, 0.5180037, 8.271217)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -32.38732, 0.5180037, 8.271217)
|
||||||
script = ExtResource("4_pi0y7")
|
script = ExtResource("4_pi0y7")
|
||||||
team = 1
|
team = 1
|
||||||
spawn_radius = 10.0
|
spawn_radius = 5.0
|
||||||
|
|
||||||
[node name="SpectatorSpawn" type="Marker3D" parent="PlayersContainer"]
|
[node name="SpectatorSpawn" type="Marker3D" parent="PlayersContainer"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.0165482, 17.832424, 2.9756432)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.0165482, 17.832424, 2.9756432)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=25 format=3 uid="uid://dpsr6ug3pkb40"]
|
[gd_scene load_steps=26 format=3 uid="uid://dpsr6ug3pkb40"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"]
|
[ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"]
|
||||||
[ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"]
|
[ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"]
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
[ext_resource type="Script" uid="uid://3777rkbebgjm" path="res://scripts/state_machine/machine.gd" id="8_f1ej7"]
|
[ext_resource type="Script" uid="uid://3777rkbebgjm" path="res://scripts/state_machine/machine.gd" id="8_f1ej7"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c2r8dbudbs7l3" path="res://models/characters/worldmodels/molikman_ingame.glb" id="8_smehm"]
|
[ext_resource type="PackedScene" uid="uid://c2r8dbudbs7l3" path="res://models/characters/worldmodels/molikman_ingame.glb" id="8_smehm"]
|
||||||
[ext_resource type="Script" uid="uid://bv8sgx78s8hwn" path="res://scripts/player/states/crouching.gd" id="9_oprun"]
|
[ext_resource type="Script" uid="uid://bv8sgx78s8hwn" path="res://scripts/player/states/crouching.gd" id="9_oprun"]
|
||||||
|
[ext_resource type="Script" uid="uid://dmy6ahci16los" path="res://scripts/debug/inventory_preview.gd" id="9_ownlk"]
|
||||||
[ext_resource type="Script" uid="uid://u0e2b2mvij1k" path="res://scripts/player/states/standing.gd" id="10_a8ls1"]
|
[ext_resource type="Script" uid="uid://u0e2b2mvij1k" path="res://scripts/player/states/standing.gd" id="10_a8ls1"]
|
||||||
[ext_resource type="Script" uid="uid://cwasvwhm5yg0o" path="res://scripts/player/states/walk.gd" id="11_qfm1y"]
|
[ext_resource type="Script" uid="uid://cwasvwhm5yg0o" path="res://scripts/player/states/walk.gd" id="11_qfm1y"]
|
||||||
[ext_resource type="Script" uid="uid://cq4i0afwesdm3" path="res://scripts/player/states/falling.gd" id="12_fulsm"]
|
[ext_resource type="Script" uid="uid://cq4i0afwesdm3" path="res://scripts/player/states/falling.gd" id="12_fulsm"]
|
||||||
|
|
@ -199,14 +200,17 @@ layout_mode = 0
|
||||||
offset_right = 40.0
|
offset_right = 40.0
|
||||||
offset_bottom = 40.0
|
offset_bottom = 40.0
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="HUD/PanelContainer"]
|
[node name="VBoxContainer2" type="VBoxContainer" parent="HUD/PanelContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Properties" type="VBoxContainer" parent="HUD/PanelContainer/VBoxContainer2"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
script = ExtResource("7_oprun")
|
script = ExtResource("7_oprun")
|
||||||
property_array = Dictionary[NodePath, StringName]({
|
|
||||||
NodePath("../../../BodyStateMachine"): &"current_state",
|
[node name="InventoryPreview" type="Label" parent="HUD/PanelContainer/VBoxContainer2" node_paths=PackedStringArray("inventory")]
|
||||||
NodePath("../../../WeaponSystem"): &"current_state",
|
layout_mode = 2
|
||||||
NodePath("../../../AnimationPlayer"): &"current_animation"
|
script = ExtResource("9_ownlk")
|
||||||
})
|
inventory = NodePath("../../../../WeaponSystem")
|
||||||
|
|
||||||
[node name="Crosshair" type="Control" parent="HUD"]
|
[node name="Crosshair" type="Control" parent="HUD"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|
|
||||||
11
scripts/debug/inventory_preview.gd
Normal file
11
scripts/debug/inventory_preview.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
extends Label
|
||||||
|
|
||||||
|
|
||||||
|
@export var inventory: WeaponSystem
|
||||||
|
|
||||||
|
func _process(_delta: float) -> void:
|
||||||
|
var weapons = ""
|
||||||
|
for child in inventory.get_children():
|
||||||
|
if child is WeaponSubStateMachine:
|
||||||
|
weapons += child.name + ", "
|
||||||
|
text = weapons
|
||||||
1
scripts/debug/inventory_preview.gd.uid
Normal file
1
scripts/debug/inventory_preview.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dmy6ahci16los
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
extends RigidBody3D
|
|
||||||
|
|
||||||
|
|
||||||
@export var radius: float
|
|
||||||
@export var fog: FogVolume
|
|
||||||
|
|
||||||
var bounce_count: int = 0
|
|
||||||
|
|
||||||
|
|
||||||
func _on_body_entered(_body: Node) -> void:
|
|
||||||
if bounce_count > 2:
|
|
||||||
return
|
|
||||||
bounce_count += 1
|
|
||||||
if bounce_count == 2:
|
|
||||||
smoke()
|
|
||||||
|
|
||||||
func smoke():
|
|
||||||
var tween = create_tween().set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_EXPO)
|
|
||||||
tween.tween_property(fog,"size",Vector3(radius,radius,radius),1.0)
|
|
||||||
tween.tween_interval(10)
|
|
||||||
tween.tween_property(fog.material,"density",0,1.0)
|
|
||||||
tween.tween_callback(queue_free)
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
uid://t5jjqwnkxgvo
|
|
||||||
|
|
@ -7,9 +7,3 @@ const IMPULSE = 10
|
||||||
@export var slot: StringName
|
@export var slot: StringName
|
||||||
@export var weapon: WeaponSubStateMachine
|
@export var weapon: WeaponSubStateMachine
|
||||||
@export var team: Session.TEAMS
|
@export var team: Session.TEAMS
|
||||||
|
|
||||||
@rpc("any_peer","call_local","reliable")
|
|
||||||
func drop(direction: Vector3,new_position: Vector3):
|
|
||||||
apply_impulse(direction * IMPULSE)
|
|
||||||
global_position = new_position
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,9 +55,10 @@ func add(state: WeaponSubStateMachine, slot: StringName) -> void:
|
||||||
state.player = player
|
state.player = player
|
||||||
state.request_return.connect(return_to_previous)
|
state.request_return.connect(return_to_previous)
|
||||||
|
|
||||||
func switch(to: StringName):
|
func switch(to: StringName, exit: bool = true):
|
||||||
if slots.has(to) == false or slots[to] == null or slots[to] == current_state or is_multiplayer_authority() == false:
|
if slots.has(to) == false or slots[to] == null or slots[to] == current_state or is_multiplayer_authority() == false:
|
||||||
return
|
return
|
||||||
|
if current_state != null and exit:
|
||||||
current_state.exit()
|
current_state.exit()
|
||||||
if current_state.can_be_previous:
|
if current_state.can_be_previous:
|
||||||
last_slot = slots.find_key(current_state)
|
last_slot = slots.find_key(current_state)
|
||||||
|
|
@ -85,8 +86,8 @@ func drop():
|
||||||
|
|
||||||
$"../PickupRange".start_temp_ignore()
|
$"../PickupRange".start_temp_ignore()
|
||||||
|
|
||||||
Session.despawn(current_state.get_path())
|
current_state.queue_free()
|
||||||
return_to_previous()
|
return_to_previous(false)
|
||||||
|
|
||||||
# Spawn function
|
# Spawn function
|
||||||
# Data should be a dictionary with these keys:
|
# Data should be a dictionary with these keys:
|
||||||
|
|
@ -105,14 +106,15 @@ func pick_up_weapon(data: Variant) -> Node:
|
||||||
func on_weapon_added(weapon: Node):
|
func on_weapon_added(weapon: Node):
|
||||||
add(weapon,weapon.slot)
|
add(weapon,weapon.slot)
|
||||||
|
|
||||||
func return_to_previous():
|
func return_to_previous(exit: bool = true):
|
||||||
if last_slot != "":
|
if last_slot != "":
|
||||||
switch(last_slot)
|
switch(last_slot, exit)
|
||||||
else:
|
else:
|
||||||
switch("knife")
|
switch("knife", exit)
|
||||||
|
|
||||||
@rpc("authority","call_remote","reliable")
|
@rpc("authority","call_remote","reliable")
|
||||||
func update_remotes(to: StringName):
|
func update_remotes(to: StringName):
|
||||||
|
if current_state != null:
|
||||||
current_state.exit()
|
current_state.exit()
|
||||||
current_state = slots[to]
|
current_state = slots[to]
|
||||||
current_state.enter()
|
current_state.enter()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue