Proper death
This commit is contained in:
parent
e8af70b198
commit
d918533ebe
4 changed files with 20 additions and 4 deletions
|
|
@ -27,6 +27,8 @@ signal slots_updated(current_slot: StringName,slots: Dictionary[StringName,Strin
|
|||
signal ammo_updated(ammo: int, remaining_ammo: int)
|
||||
|
||||
func _ready() -> void:
|
||||
if not multiplayer.is_server():
|
||||
return
|
||||
player_input.drop.connect(drop_current)
|
||||
player_input.fire_begin.connect(use_begin)
|
||||
player_input.fire_end.connect(use_end)
|
||||
|
|
@ -128,6 +130,13 @@ func drop_slot(slot: StringName):
|
|||
return
|
||||
drop(slots[slot])
|
||||
|
||||
func drop_death():
|
||||
if slots["primary"] != null:
|
||||
drop_slot("primary")
|
||||
elif slots["secondary"] != null:
|
||||
drop_slot("secondary")
|
||||
drop_slot("bomb")
|
||||
|
||||
func check_for_empty() -> void:
|
||||
if is_multiplayer_authority() == false:
|
||||
return
|
||||
|
|
@ -174,35 +183,39 @@ func disable() -> void:
|
|||
disabled = true
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if not multiplayer.is_server():
|
||||
return
|
||||
if current_state == null or disabled:
|
||||
return
|
||||
current_state.update(delta)
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if not multiplayer.is_server():
|
||||
return
|
||||
if current_state == null or disabled:
|
||||
return
|
||||
current_state.physics_update(delta)
|
||||
|
||||
func use_begin() -> void:
|
||||
if Session.round_state == Session.ROUND_STATES.BUY:
|
||||
if not multiplayer.is_server() or Session.round_state == Session.ROUND_STATES.BUY or disabled:
|
||||
return
|
||||
if current_state != null:
|
||||
current_state.use_begin()
|
||||
|
||||
func use_end() -> void:
|
||||
if Session.round_state == Session.ROUND_STATES.BUY:
|
||||
if not multiplayer.is_server() or Session.round_state == Session.ROUND_STATES.BUY or disabled:
|
||||
return
|
||||
if current_state != null:
|
||||
current_state.use_end()
|
||||
|
||||
func alternate_state() -> void:
|
||||
if Session.round_state == Session.ROUND_STATES.BUY:
|
||||
if not multiplayer.is_server() or Session.round_state == Session.ROUND_STATES.BUY or disabled:
|
||||
return
|
||||
if current_state != null:
|
||||
current_state.alternate_state()
|
||||
|
||||
func switch_mode() -> void:
|
||||
if Session.round_state == Session.ROUND_STATES.BUY:
|
||||
if not multiplayer.is_server() or Session.round_state == Session.ROUND_STATES.BUY or disabled:
|
||||
return
|
||||
if current_state != null:
|
||||
current_state.switch_mode()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue