summaryrefslogtreecommitdiff
path: root/godot/scripts/characters/NetworkedCharacter.gd
diff options
context:
space:
mode:
Diffstat (limited to 'godot/scripts/characters/NetworkedCharacter.gd')
-rw-r--r--godot/scripts/characters/NetworkedCharacter.gd14
1 files changed, 11 insertions, 3 deletions
diff --git a/godot/scripts/characters/NetworkedCharacter.gd b/godot/scripts/characters/NetworkedCharacter.gd
index c8e90a4..c14d46f 100644
--- a/godot/scripts/characters/NetworkedCharacter.gd
+++ b/godot/scripts/characters/NetworkedCharacter.gd
@@ -15,14 +15,21 @@ var world: Spatial = null
var carrying: bool = false
var carrying_object: NetObject = null
+var loading: bool = false
+var load_target: RigidBody = null
+var load_ammo: String
+
# Control
var controlling_machine: bool = false #whether character is riding/controlling something
var machine: RigidBody = null
-export var is_player: bool = false #whether character is currently controlled by a player
+var is_player: bool = false #whether character is currently controlled by a player
var ladder_m: Spatial = null
+const inventory_caps: Dictionary = {"cannonball" : 1}
+remote var inventory: Dictionary = {"cannonball" : 0} #
+
func get_init_info() -> Dictionary:
- return {"linear_velocity" : linear_velocity, "angular_velocity" : angular_velocity, "controlling_machine" : controlling_machine, "team" : team, "health" : health, "nametag" : $Nametag.text}
+ return {"linear_velocity" : linear_velocity, "angular_velocity" : angular_velocity, "controlling_machine" : controlling_machine, "team" : team, "health" : health, "inventory": inventory, "nametag" : $Nametag.text}
func mp_init(init_info: Dictionary):
for variable in init_info.keys():
@@ -60,11 +67,12 @@ func take_control_of_machine(slave_machine: RigidBody):
controlling_machine = true
func lose_machine():
- if is_network_master(): world.cam.attach(self, "FIRSTPERSON", "./Neck/Head")
+ if is_network_master() and get_network_master() != 1: world.cam.attach(self, "FIRSTPERSON", "./Neck/Head")
controlling_machine = false
machine = null
remotesync func damage(dmg_amt: int, _type: String, shooter: Array, extra: String):
+ print(dmg_amt)
health -= dmg_amt
if health <= 0 and is_network_master():
if shooter[0] != get_network_master() and shooter[0] != 1: world.rpc_id(shooter[0], "game_killsound")