Deploy and shooting brought back
This commit is contained in:
parent
c1548e5451
commit
b94e4cdf30
10 changed files with 25 additions and 15 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@
|
|||
.godot/
|
||||
/android/
|
||||
exports/
|
||||
deploy.sh
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ rm -rf \"{temp_dir}\""
|
|||
|
||||
[preset.1]
|
||||
|
||||
name="Windows Desktop"
|
||||
name="Windows"
|
||||
platform="Windows Desktop"
|
||||
runnable=true
|
||||
advanced_options=false
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
[ext_resource type="Script" uid="uid://dk1gjbuydemmb" path="res://scripts/multiplayer/plant_site/plant_site.gd" id="8_oujx2"]
|
||||
[ext_resource type="Script" uid="uid://b4cpux52fmx5o" path="res://scripts/multiplayer/plant_site/plant_deadzone.gd" id="9_1wlgq"]
|
||||
[ext_resource type="Material" uid="uid://c6xa4phihtya2" path="res://materials/Redmat.tres" id="9_ysk2e"]
|
||||
[ext_resource type="Script" path="res://scripts/multiplayer/spawn_system/team_spawner.gd" id="10_02ic3"]
|
||||
[ext_resource type="Script" uid="uid://ypgm3aplt78m" path="res://scripts/multiplayer/spawn_system/team_spawner.gd" id="10_02ic3"]
|
||||
[ext_resource type="Script" uid="uid://3i00rp8urth7" path="res://scripts/object_container.gd" id="11_02ic3"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_ysk2e"]
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
[ext_resource type="Script" uid="uid://b2djbdh05pbcn" path="res://scripts/player/team_color_switcher.gd" id="25_1mtds"]
|
||||
[ext_resource type="Material" uid="uid://cjb0h3of85nc2" path="res://materials/players/molikman/mat_Molikman.tres" id="26_r2jxp"]
|
||||
[ext_resource type="Texture2D" uid="uid://15mf4452fse0" path="res://textures/players/molikman/molikman_ingame_Molikman_blue.png" id="27_j3w78"]
|
||||
[ext_resource type="Script" uid="uid://dfvnx8f1v6m5g" path="res://scripts/multiplayer/player_input.gd" id="37_b2eak"]
|
||||
[ext_resource type="Script" path="res://scripts/multiplayer/player_input.gd" id="37_b2eak"]
|
||||
|
||||
[sub_resource type="ArrayMesh" id="ArrayMesh_lot4n"]
|
||||
_surfaces = [{
|
||||
|
|
@ -8823,11 +8823,12 @@ player = NodePath("..")
|
|||
player_input = NodePath("../PlayerInput")
|
||||
jump_velocity = 12.0
|
||||
|
||||
[node name="WeaponSystem" type="Node" parent="." node_paths=PackedStringArray("animation_player", "camera", "player")]
|
||||
[node name="WeaponSystem" type="Node" parent="." node_paths=PackedStringArray("animation_player", "camera", "player", "player_input")]
|
||||
script = ExtResource("4_qlg0r")
|
||||
animation_player = NodePath("../Camera3D/molikman_hands/AnimationPlayer")
|
||||
camera = NodePath("../Camera3D")
|
||||
player = NodePath("..")
|
||||
player_input = NodePath("../PlayerInput")
|
||||
|
||||
[node name="WeaponSpawner" type="MultiplayerSpawner" parent="WeaponSystem"]
|
||||
spawn_path = NodePath("..")
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ func shoot(id:int , damage: int, distance: float) -> void:
|
|||
var collision = space.intersect_ray(ray)
|
||||
|
||||
if collision != {} and collision["collider"] is Player:
|
||||
collision["collider"].take_damage.rpc_id(int(collision["collider"].name),damage)
|
||||
collision["collider"].take_damage(damage)
|
||||
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ func spawn_player(id: int) -> void:
|
|||
var angle = randf_range(0,TAU)
|
||||
var new_position = global_position + Vector3.RIGHT.rotated(Vector3.UP,angle) * distance
|
||||
inst.player_id = id
|
||||
inst.team = team
|
||||
get_parent().add_child(inst)
|
||||
inst.global_position = new_position
|
||||
inst.team = team
|
||||
|
||||
func spawn_spectator(id: int) -> void:
|
||||
var spectator: PackedScene = load("res://scenes/spectator.tscn")
|
||||
|
|
@ -54,6 +54,6 @@ func spawn_spectator(id: int) -> void:
|
|||
var distance = randf_range(0,spawn_radius)
|
||||
var angle = randf_range(0,TAU)
|
||||
var new_position = global_position + Vector3.RIGHT.rotated(Vector3.UP,angle) * distance
|
||||
inst.team = team
|
||||
get_parent().add_child(inst)
|
||||
inst.global_position = new_position
|
||||
inst.team = team
|
||||
|
|
|
|||
|
|
@ -4,15 +4,10 @@ extends WeaponState
|
|||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(with_morphems("idle"))
|
||||
machine.player.get_node("PlayerInput").reload.connect(init_reload)
|
||||
|
||||
func exit() -> void:
|
||||
pass
|
||||
|
||||
func state_input(event: InputEvent) -> void:
|
||||
if not machine.is_multiplayer_authority() or Input.mouse_mode != Input.MouseMode.MOUSE_MODE_CAPTURED: return
|
||||
|
||||
if event.is_action_pressed("plr_reload"):
|
||||
init_reload.rpc()
|
||||
machine.player.get_node("PlayerInput").reload.disconnect(init_reload)
|
||||
|
||||
func use_begin() -> void:
|
||||
if machine.ammo > 0:
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ func use_begin() -> void:
|
|||
func fire() -> void:
|
||||
if machine.ammo == 0 or fire_timer.time_left > 0:
|
||||
return
|
||||
machine.player.get_node("ShootAudio").multiplayer_play()
|
||||
machine.ammo -= 1
|
||||
bullets_shot += 1
|
||||
|
||||
|
|
@ -40,6 +39,7 @@ func fire() -> void:
|
|||
|
||||
if is_multiplayer_authority():
|
||||
Session.shoot(int(machine.player.name),damage,shoot_distance)
|
||||
machine.player.get_node("ShootAudio").multiplayer_play()
|
||||
|
||||
fire_timer.start()
|
||||
machine.player_camera.recoil(horizontal_curve.sample(bullets_shot),vertical_curve.sample(bullets_shot))
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ func exit() -> void:
|
|||
@rpc("authority","call_local","reliable")
|
||||
func use_begin() -> void:
|
||||
current_state.use_begin()
|
||||
|
||||
@rpc("authority","call_local","reliable")
|
||||
func use_end() -> void:
|
||||
current_state.use_end()
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ class_name WeaponSystem
|
|||
@export var animation_player: AnimationPlayer
|
||||
@export var camera: PlayerCamera
|
||||
@export var player: Player
|
||||
@export var player_input: PlayerInput
|
||||
|
||||
var current_state: WeaponSubStateMachine
|
||||
var last_slot: StringName
|
||||
|
|
@ -27,6 +28,9 @@ signal ammo_updated(ammo: int, remaining_ammo: int)
|
|||
|
||||
func _ready() -> void:
|
||||
$WeaponSpawner.spawn_function = pick_up_weapon
|
||||
player_input.drop.connect(drop_current)
|
||||
player_input.fire_begin.connect(use_begin)
|
||||
player_input.fire_end.connect(use_end)
|
||||
|
||||
func get_speed_modifier() -> float:
|
||||
if current_state == null:
|
||||
|
|
@ -89,6 +93,8 @@ func drop_current():
|
|||
drop(current_state)
|
||||
|
||||
func drop(weapon: WeaponSubStateMachine) -> void:
|
||||
if not is_multiplayer_authority():
|
||||
return
|
||||
if slots.find_key(weapon) == "knife":
|
||||
return
|
||||
var drop_data: Dictionary = {}
|
||||
|
|
@ -161,3 +167,9 @@ func _physics_process(delta: float) -> void:
|
|||
if current_state == null or disabled:
|
||||
return
|
||||
current_state.physics_update(delta)
|
||||
|
||||
func use_begin() -> void:
|
||||
current_state.use_begin.rpc()
|
||||
|
||||
func use_end() -> void:
|
||||
current_state.use_end.rpc()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue