Many fixes
This commit is contained in:
parent
f234ca974e
commit
e758c9f042
11 changed files with 8784 additions and 8739 deletions
|
|
@ -6,10 +6,10 @@ func _on_visibility_changed() -> void:
|
|||
process_mode = Node.PROCESS_MODE_INHERIT if visible else Node.PROCESS_MODE_DISABLED
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
return
|
||||
if player_id == -1:
|
||||
%PlayerNickname.text = ""
|
||||
%Money.text = ""
|
||||
else:
|
||||
if Session.player_data.has(player_id):
|
||||
%PlayerNickname.text = Session.player_data[player_id]["nickname"]
|
||||
%Money.text = str(Session.player_data[player_id]["money"])
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ signal lobby_created
|
|||
signal lobby_joined
|
||||
signal lobby_closed
|
||||
signal update_teams_state
|
||||
signal client_data_updated(id)
|
||||
|
||||
var in_lobby: bool = false
|
||||
|
||||
|
|
@ -36,6 +37,7 @@ func player_left(id: int) -> void:
|
|||
client_nicknames.erase(id)
|
||||
|
||||
update_teams_state.emit()
|
||||
client_data_updated.emit(-id)
|
||||
|
||||
func server_disconnected() -> void:
|
||||
leave()
|
||||
|
|
@ -84,6 +86,7 @@ func recieve_client_data(data: Dictionary):
|
|||
client_nicknames[id] = nickname
|
||||
|
||||
sync_client_data.rpc(client_nicknames)
|
||||
client_data_updated.emit(id)
|
||||
|
||||
@rpc("authority","call_remote")
|
||||
func sync_client_data(new_client_nicknames: Dictionary[int,StringName]):
|
||||
|
|
|
|||
|
|
@ -87,6 +87,8 @@ func send_session_data(peer_id: int = -1):
|
|||
if multiplayer.is_server() == false or session_started_flag == false:
|
||||
return
|
||||
|
||||
init_player_data(peer_id)
|
||||
|
||||
var data: PackedByteArray
|
||||
data.resize(5)
|
||||
data.encode_u8(0,current_round)
|
||||
|
|
@ -95,11 +97,29 @@ func send_session_data(peer_id: int = -1):
|
|||
data.encode_u8(3,round_state)
|
||||
data.encode_u8(4,session_started_flag)
|
||||
|
||||
|
||||
|
||||
if peer_id == -1:
|
||||
recieve_session_data.rpc(data,player_data)
|
||||
else:
|
||||
recieve_session_data.rpc_id(peer_id,data,player_data)
|
||||
|
||||
func init_player_data(id: int) -> void:
|
||||
if Lobby.client_nicknames.has(id) == false:
|
||||
while true:
|
||||
var wait_id = await Lobby.client_data_updated
|
||||
if wait_id == id:
|
||||
break
|
||||
elif wait_id == -id:
|
||||
return
|
||||
player_data[id] = {
|
||||
"money" : START_MONEY,
|
||||
"nickname" : Lobby.client_nicknames[id],
|
||||
"saved_slots" : {},
|
||||
"kills" : 0,
|
||||
"deaths" : 0,
|
||||
}
|
||||
|
||||
@rpc("authority","call_remote","unreliable")
|
||||
func recieve_session_data(data: PackedByteArray,players_data_sent: Dictionary[int,Dictionary]):
|
||||
if not is_server_request():
|
||||
|
|
|
|||
17394
players/molikman.tscn
17394
players/molikman.tscn
File diff suppressed because one or more lines are too long
|
|
@ -76,3 +76,9 @@ func take_damage(damage: int):
|
|||
hp -= damage
|
||||
damaged.emit()
|
||||
$DamageAudio.multiplayer_play()
|
||||
|
||||
func show_weapon(weapon: StringName):
|
||||
for model in weapon_models:
|
||||
weapon_models[model].hide()
|
||||
if weapon_models.has(weapon):
|
||||
weapon_models[weapon].show()
|
||||
|
|
|
|||
|
|
@ -65,11 +65,10 @@ func _ready() -> void:
|
|||
|
||||
func _enter() -> void:
|
||||
super()
|
||||
player.weapon_models[weapon_gid].show()
|
||||
player.show_weapon(weapon_gid)
|
||||
|
||||
func _exit() -> void:
|
||||
super()
|
||||
player.weapon_models[weapon_gid].hide()
|
||||
|
||||
func use_begin() -> void:
|
||||
if current_state != null:
|
||||
|
|
|
|||
|
|
@ -97,8 +97,9 @@ func switch(to: StringName, exit: bool = true):
|
|||
if exit:
|
||||
current_state._exit()
|
||||
if current_state.can_be_previous:
|
||||
var found = slots.find_key(current_state)
|
||||
last_slot = found if found else ""
|
||||
last_slot = get_current_slot()
|
||||
else:
|
||||
last_slot = ""
|
||||
current_state = slots[to]
|
||||
current_state._enter()
|
||||
|
||||
|
|
@ -107,11 +108,20 @@ func switch(to: StringName, exit: bool = true):
|
|||
notify_slots_updated()
|
||||
|
||||
func return_to_previous(exit: bool = true):
|
||||
if last_slot == get_current_slot():
|
||||
last_slot = "knife"
|
||||
if last_slot != "":
|
||||
switch(last_slot, exit)
|
||||
else:
|
||||
switch("knife", exit)
|
||||
|
||||
func get_current_slot() -> StringName:
|
||||
if current_state == null:
|
||||
return "knife"
|
||||
else:
|
||||
var found = slots.find_key(current_state)
|
||||
return found if found else ""
|
||||
|
||||
func drop_current():
|
||||
drop(current_state)
|
||||
|
||||
|
|
@ -180,7 +190,7 @@ func notify_slots_updated():
|
|||
else:
|
||||
display_slots[key] = slots[key].weapon_gid
|
||||
var current_slot: StringName = ""
|
||||
var found = slots.find_key(current_state)
|
||||
var found = get_current_slot()
|
||||
if found:
|
||||
current_slot = found
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ vertical_curve = SubResource("Curve_cmn6f")
|
|||
horizontal_curve = SubResource("Curve_016ti")
|
||||
damage_reduction_curve = SubResource("Curve_bwg3m")
|
||||
emptyable = true
|
||||
torso_damage = 22
|
||||
head_damage = 60
|
||||
limb_damage = 12
|
||||
torso_damage = 35
|
||||
head_damage = 80
|
||||
limb_damage = 22
|
||||
fire_timer = NodePath("../FireTimer")
|
||||
|
||||
[node name="Reload" type="Node" parent="."]
|
||||
|
|
|
|||
|
|
@ -15,14 +15,15 @@ func _physics_process(delta: float) -> void:
|
|||
|
||||
var collision = move_and_collide(velocity * delta)
|
||||
if collision:
|
||||
if collision.get_normal().y > 0:
|
||||
if collision.get_normal().y > 0.05:
|
||||
var fire: Node3D = preload("res://weapons/molikman/molik/molikman_molotov_fire.tscn").instantiate()
|
||||
Session.dynamic_objects_parent.add_child(fire,true)
|
||||
fire.global_position = global_position
|
||||
fire.quaternion *= Quaternion(Vector3.UP,collision.get_normal())
|
||||
queue_free()
|
||||
else:
|
||||
var normal = collision.get_normal()
|
||||
velocity = velocity.bounce(normal) * 0.5
|
||||
$MultiplayerAudio3D.multiplayer_play()
|
||||
|
||||
$molotov2.quaternion *= Quaternion($molotov2.basis.y, velocity.normalized())
|
||||
$molotov.quaternion *= Quaternion($molotov.basis.y, velocity.normalized())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ properties/0/replication_mode = 1
|
|||
collision_layer = 8
|
||||
script = ExtResource("1_aqokr")
|
||||
|
||||
[node name="molotov2" parent="." instance=ExtResource("2_dcuri")]
|
||||
[node name="molotov" parent="." instance=ExtResource("2_dcuri")]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("SphereShape3D_aqokr")
|
||||
|
|
|
|||
|
|
@ -12,6 +12,33 @@
|
|||
[ext_resource type="Texture2D" uid="uid://va158xyrsvb4" path="res://textures/players/molikman/molotov/fire_particle.png" id="7_18xly"]
|
||||
[ext_resource type="AudioStream" uid="uid://blnblkd6eoldv" path="res://audio/molik_idle.ogg" id="7_apqju"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bwl5g"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Decal:texture_albedo")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("2_fm7jn")]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Decal:texture_emission")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("2_fm7jn")]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_m625o"]
|
||||
resource_name = "main"
|
||||
loop_mode = 1
|
||||
|
|
@ -41,33 +68,6 @@ tracks/1/keys = {
|
|||
"values": [ExtResource("2_fm7jn"), ExtResource("3_18xly"), ExtResource("4_wpp30"), ExtResource("5_66mwf"), ExtResource("6_bt4sy")]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bwl5g"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Decal:texture_albedo")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("2_fm7jn")]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Decal:texture_emission")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("2_fm7jn")]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_oujc3"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_bwl5g"),
|
||||
|
|
@ -75,6 +75,7 @@ _data = {
|
|||
}
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_fm7jn"]
|
||||
height = 1.0615234
|
||||
radius = 3.5
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_18xly"]
|
||||
|
|
@ -168,6 +169,9 @@ properties/0/replication_mode = 1
|
|||
properties/1/path = NodePath("Decal:size")
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 1
|
||||
properties/2/path = NodePath(".:rotation")
|
||||
properties/2/spawn = true
|
||||
properties/2/replication_mode = 1
|
||||
|
||||
[node name="MolikmanMolotovFire" type="Area3D" node_paths=PackedStringArray("damage_timer")]
|
||||
collision_layer = 8
|
||||
|
|
@ -177,10 +181,11 @@ dps = 33.333
|
|||
damage_timer = NodePath("DamageTimer")
|
||||
|
||||
[node name="Decal" type="Decal" parent="."]
|
||||
size = Vector3(7.5, 3, 7.5)
|
||||
size = Vector3(7.5, 3.2404785, 7.5)
|
||||
texture_albedo = ExtResource("2_fm7jn")
|
||||
texture_emission = ExtResource("2_fm7jn")
|
||||
emission_energy = 0.25
|
||||
normal_fade = 0.75
|
||||
cull_mask = 1048572
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
|
|
@ -190,6 +195,7 @@ libraries = {
|
|||
autoplay = "main"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.46923828, 0)
|
||||
shape = SubResource("CylinderShape3D_fm7jn")
|
||||
|
||||
[node name="IdleParticles" type="GPUParticles3D" parent="."]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue