More work on pickups, started to implement the UI for data keys, swapped trap selections, FIRST PASS OF MULTIPLAYER CHECKS, title screen swapped.
This commit is contained in:
@@ -5,6 +5,7 @@ const SERVER_PORT = 8080
|
||||
const SERVER_IP = "127.0.0.1"
|
||||
var handle : String
|
||||
var id : int = 1
|
||||
var room_id : String
|
||||
var players : Dictionary = {}
|
||||
signal client_added(handle : String, id : int)
|
||||
signal all_ready()
|
||||
@@ -32,8 +33,9 @@ func become_host() -> void:
|
||||
|
||||
server_peer.host_room(true, JSON.stringify(metadata))
|
||||
print("Hosting Room...")
|
||||
var room_id = await server_peer.room_connected
|
||||
await server_peer.room_connected
|
||||
print("Connected to room: ", server_peer.room_id)
|
||||
Multiplayer.room_id = server_peer.room_id
|
||||
#server_peer.get_rooms()
|
||||
print("GETTING ROOMS!")
|
||||
#var rooms = await server_peer.rooms_received
|
||||
|
||||
@@ -150,6 +150,7 @@ func activate() -> void:
|
||||
body.fling(direction, 5.0)
|
||||
Type.PURGE:
|
||||
var expl = purge_explosion_template.instantiate()
|
||||
expl.one_shot = true
|
||||
Game.level.add_vfx(expl, square)
|
||||
explode = true
|
||||
Type.TRIGGER:
|
||||
@@ -157,7 +158,9 @@ func activate() -> void:
|
||||
Game.level.add_vfx(expl, square)
|
||||
explode = true
|
||||
Type.DESTROY:
|
||||
|
||||
var expl = destroy_explosion_template.instantiate()
|
||||
expl.one_shot = true
|
||||
Game.level.add_vfx(expl, square)
|
||||
explode = true
|
||||
Type.INFECT:
|
||||
@@ -199,7 +202,7 @@ func delay_trigger() -> void:
|
||||
|
||||
|
||||
func _on_body_entered(body: Node3D) -> void:
|
||||
if type == Type.INFECT or type == Type.DESTROY:
|
||||
if type == Type.TRIGGER or type == Type.INFECT or type == Type.DESTROY:
|
||||
return
|
||||
|
||||
if body.id == hack_owner:
|
||||
|
||||
@@ -22,7 +22,7 @@ func _on_hack_quantity_changed(hack_index, qty) -> void:
|
||||
hicon.set_quantity(qty)
|
||||
|
||||
func _on_hack_cycled(hack_index) -> void:
|
||||
hack_container.position.x = -hack_index * 150
|
||||
hack_container.position.x = -hack_index * 162
|
||||
%LeftArrow.visible = (hack_index != 0)
|
||||
%RightArrow.visible = (hack_index != hack_container.get_children().size() - 1)
|
||||
cycle_sound.play()
|
||||
|
||||
@@ -38,7 +38,7 @@ func _ready() -> void:
|
||||
Game.level = self
|
||||
if Game.mode == Game.Modes.STORY:
|
||||
setup()
|
||||
add_level_hack.call_deferred(Hack.Type.PURGE, Vector3.ZERO, Vector3i(-2,2,0))
|
||||
#add_level_hack.call_deferred(Hack.Type.PURGE, Vector3.ZERO, Vector3i(-2,2,0))
|
||||
|
||||
func setup() -> void:
|
||||
if Multiplayer.is_host():
|
||||
|
||||
@@ -2,7 +2,7 @@ extends MultiplayerSpawner
|
||||
|
||||
var host : bool
|
||||
var handle : String
|
||||
|
||||
var room
|
||||
func _ready() -> void:
|
||||
Multiplayer.client_added.connect(_on_client_added)
|
||||
|
||||
@@ -33,8 +33,9 @@ func _on_start_hosting_button_pressed() -> void:
|
||||
#Set fields
|
||||
%ParticipantsText.text = "[color=FFFF00]*%s (HOST)[/color]\n" % handle
|
||||
%"Host Waiting".visible = true
|
||||
%IPLabel.text = Multiplayer.get_local_ip()
|
||||
Multiplayer.become_host()
|
||||
await Multiplayer.become_host()
|
||||
%RoomLabel.text = Multiplayer.room_id
|
||||
|
||||
|
||||
|
||||
func _on_hosting_back_button_pressed() -> void:
|
||||
@@ -62,7 +63,7 @@ func _on_join_button_pressed() -> void:
|
||||
#Check for valid game
|
||||
#If found
|
||||
%Joining.visible = false
|
||||
if await Multiplayer.join_game(handle, %IPEdit.text):
|
||||
if await Multiplayer.join_game(handle, %RoomEdit.text):
|
||||
%"Host Waiting".visible = true
|
||||
%StartButton.visible = false
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ func set_pawn_body(pb : PawnBody) -> void:
|
||||
pb.shooting.connect(fire_ranged)
|
||||
reload_sound = body.find_child("ReloadSound")
|
||||
add_child(body)
|
||||
body.set_animation_length("Ranged Fire", ranged_recovery_time)
|
||||
body.set_animation_length("Ranged Attack", ranged_recovery_time)
|
||||
struggling.connect(body._on_struggle_changed)
|
||||
|
||||
|
||||
@@ -476,8 +476,9 @@ func start_installing() -> void:
|
||||
|
||||
func stop_installing() -> void:
|
||||
state = State.NORMAL
|
||||
range_sphere.queue_free()
|
||||
range_sphere = null
|
||||
if range_sphere != null:
|
||||
range_sphere.queue_free()
|
||||
range_sphere = null
|
||||
|
||||
@rpc("authority", "call_local")
|
||||
func update_detect_region(update : bool) -> void:
|
||||
@@ -727,7 +728,38 @@ func is_crouching() -> bool:
|
||||
State.UNINSTALLING: result = true
|
||||
return result
|
||||
|
||||
@rpc("any_peer", "call_local")
|
||||
func add_hack(type : Hack.Type) -> void:
|
||||
for hd : PawnLevelData.HackData in data.hacks:
|
||||
if hd.type == type:
|
||||
hd.max_quantity += 1
|
||||
hd.quantity += 1
|
||||
hack_list_changed.emit(data.hacks, data.active_hack)
|
||||
return
|
||||
#Adding a new one
|
||||
var hd : PawnLevelData.HackData = PawnLevelData.HackData.new(type, 1, 1)
|
||||
data.hacks.append(hd)
|
||||
hack_list_changed.emit(data.hacks, data.active_hack)
|
||||
|
||||
func add_random_hack(advanced : bool) -> void:
|
||||
#Get their current hack list
|
||||
var choices : Dictionary = {
|
||||
Hack.Type.DESTROY: true,
|
||||
Hack.Type.PURGE: true,
|
||||
Hack.Type.INFECT: true,
|
||||
Hack.Type.REDIRECT: true,
|
||||
Hack.Type.TRIGGER: true,
|
||||
Hack.Type.CONTAIN: true
|
||||
}
|
||||
for hd : PawnLevelData.HackData in data.hacks:
|
||||
if hd.max_quantity == 9:
|
||||
choices.erase(hd.type)
|
||||
|
||||
var choice = choices.keys().pick_random()
|
||||
add_hack.rpc(choice)
|
||||
#Create a list of possible hacks, omitting any that they have the max in already
|
||||
#Randomly pick one
|
||||
#RPC Add hack to them
|
||||
#TODO: Add random hack spawning using RPCs
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user