Add inspect with SHIFT

This commit is contained in:
Hamcha 2020-07-23 14:21:27 +02:00
parent 4d1d37a169
commit 4997130d1f
Signed by: hamcha
GPG key ID: 41467804B19A3315
12 changed files with 225 additions and 17 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
.import .import
export export
.vscode

View file

@ -7,6 +7,7 @@ class_name GameObjectComputer
enum Direction { LEFT, RIGHT, UP, DOWN } enum Direction { LEFT, RIGHT, UP, DOWN }
enum ComputerType { ShipCommand, Comms, Medical, Research, Energy, ShipEngine, Atmos, Monitoring } enum ComputerType { ShipCommand, Comms, Medical, Research, Energy, ShipEngine, Atmos, Monitoring }
export var object_name = ""
export(Direction) var direction = Direction.DOWN setget set_direction export(Direction) var direction = Direction.DOWN setget set_direction
export(ComputerType) var computer_type = ComputerType.ShipCommand setget set_type export(ComputerType) var computer_type = ComputerType.ShipCommand setget set_type
@ -120,3 +121,54 @@ func serialize():
func deserialize(data): func deserialize(data):
set_direction(data["direction"]) set_direction(data["direction"])
set_type(data["computer_type"]) set_type(data["computer_type"])
func inspect():
match computer_type:
ComputerType.ShipCommand:
return {
"type": "Control board computer",
"description": "A computer for moving the ship around the galaxy",
"interaction": "Click when near to interact"
}
ComputerType.Comms:
return {
"type": "Comms computer",
"description": "A computer for issuing and controlling communications",
"interaction": "Click when near to interact"
}
ComputerType.Medical:
return {
"type": "Medical computer",
"description": "A computer for checking health status and medical procedures",
"interaction": "Click when near to interact"
}
ComputerType.Research:
return {
"type": "R&D computer",
"description": "A computer for researching new tech and control printers",
"interaction": "Click when near to interact"
}
ComputerType.Energy:
return {
"type": "Energy supply computer",
"description": "A computer for monitoring and managing the energy grid",
"interaction": "Click when near to interact"
}
ComputerType.Atmos:
return {
"type": "Atmos computer",
"description": "A computer for monitoring and managing the air supply",
"interaction": "Click when near to interact"
}
ComputerType.ShipEngine:
return {
"type": "Engine control computer",
"description": "A computer for monitoring and managing the ship engines",
"interaction": "Click when near to interact"
}
ComputerType.Monitoring:
return {
"type": "Monitoring computer",
"description": "A computer for monitoring crew and ship status",
"interaction": "Click when near to interact"
}

View file

@ -127,6 +127,7 @@ extents = Vector2( 48, 48 )
[node name="Computer" type="StaticBody2D"] [node name="Computer" type="StaticBody2D"]
input_pickable = true input_pickable = true
collision_layer = 3
script = ExtResource( 3 ) script = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]

View file

@ -2,6 +2,7 @@ extends StaticBody2D
class_name GameObjectDoor class_name GameObjectDoor
export var object_name = ""
export(NodePath) var interlockTargetPath export(NodePath) var interlockTargetPath
var interlockTarget: GameObjectDoor = null var interlockTarget: GameObjectDoor = null
@ -54,13 +55,13 @@ func _animation_finished():
$Timer.start() $Timer.start()
if $Sprite.animation == "open": if $Sprite.animation == "open":
# Disable collider # Disable collider
collision_layer = 16 collision_layer &= ~1
collision_mask = 16 collision_mask &= ~1
emit_signal("changed", true) emit_signal("changed", true)
else: else:
# Enable collider # Enable collider
collision_mask = 1 collision_mask |= 1
collision_layer = 1 collision_layer |= 1
emit_signal("changed", false) emit_signal("changed", false)
func _input_event(_viewport, event, _shape_idx): func _input_event(_viewport, event, _shape_idx):
@ -79,5 +80,12 @@ func serialize():
func deserialize(_data): func deserialize(_data):
pass pass
func inspect():
return {
"type": "Airlock",
"description": "Allows you to move between rooms while keeping rooms air-tight sealed",
"interaction": "Click when close to manually open/close"
}
func _open_sensor_triggered(): func _open_sensor_triggered():
rpc("set_open", true) rpc("set_open", true)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=2] [gd_scene load_steps=14 format=2]
[ext_resource path="res://Actors/Objects/Door/Door.gd" type="Script" id=1] [ext_resource path="res://Actors/Objects/Door/Door.gd" type="Script" id=1]
[ext_resource path="res://Graphics/tgstation/opening-sheet.png" type="Texture" id=2] [ext_resource path="res://Graphics/tgstation/opening-sheet.png" type="Texture" id=2]
@ -42,11 +42,14 @@ animations = [ {
} ] } ]
[sub_resource type="CircleShape2D" id=8] [sub_resource type="CircleShape2D" id=8]
radius = 42.0
[sub_resource type="CircleShape2D" id=9]
radius = 18.0 radius = 18.0
[node name="Door" type="StaticBody2D"] [node name="Door" type="StaticBody2D"]
input_pickable = true input_pickable = true
collision_layer = 17 collision_layer = 19
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
@ -65,11 +68,11 @@ wait_time = 5.0
one_shot = true one_shot = true
[node name="ActivationRange" type="Area2D" parent="."] [node name="ActivationRange" type="Area2D" parent="."]
visible = false
input_pickable = false input_pickable = false
script = ExtResource( 3 ) script = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="ActivationRange"] [node name="CollisionShape2D" type="CollisionShape2D" parent="ActivationRange"]
visible = false
position = Vector2( 16, 16 ) position = Vector2( 16, 16 )
shape = SubResource( 8 ) shape = SubResource( 8 )
@ -79,7 +82,7 @@ script = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="CloseRange"] [node name="CollisionShape2D" type="CollisionShape2D" parent="CloseRange"]
position = Vector2( 16, 16 ) position = Vector2( 16, 16 )
shape = SubResource( 8 ) shape = SubResource( 9 )
[node name="PowerManager" type="Node" parent="."] [node name="PowerManager" type="Node" parent="."]
script = ExtResource( 4 ) script = ExtResource( 4 )

View file

@ -20,6 +20,7 @@ puppet var pup_transform = Transform()
onready var scene = $"/root/scene" onready var scene = $"/root/scene"
onready var world = $"/root/scene/world" onready var world = $"/root/scene/world"
onready var camera = $Camera onready var camera = $Camera
onready var netgame = $"/root/Multiplayer"
export var is_controlled = false setget set_is_controlled export var is_controlled = false setget set_is_controlled
@ -100,5 +101,5 @@ func draw_circle_arc_poly(center, radius, angle_from, angle_to, color):
points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius) points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius)
draw_polygon(points_arc, colors) draw_polygon(points_arc, colors)
func hear(_event): func get_info():
pass return netgame.player_info[get_network_master()]

View file

@ -8,7 +8,7 @@ onready var ui = $CanvasLayer/ui
onready var world = $world onready var world = $world
onready var systems = $systems onready var systems = $systems
onready var netgame = $"/root/Multiplayer" onready var netgame = $"/root/Multiplayer"
onready var physics = world.get_world_2d().direct_space_state onready var physics = world.get_world_2d().direct_space_state as Physics2DDirectSpaceState
var writing = false var writing = false

View file

@ -96,22 +96,32 @@ z_index = 10
[node name="Engine" parent="engines" instance=ExtResource( 10 )] [node name="Engine" parent="engines" instance=ExtResource( 10 )]
position = Vector2( -1024, -128 ) position = Vector2( -1024, -128 )
direction = 0 direction = 0
strength = 1.0
max_force = 0.05
[node name="Engine5" parent="engines" instance=ExtResource( 10 )] [node name="Engine5" parent="engines" instance=ExtResource( 10 )]
position = Vector2( -1024, -32 ) position = Vector2( -1024, -32 )
direction = 0 direction = 0
strength = 1.0
max_force = 0.05
[node name="Engine4" parent="engines" instance=ExtResource( 10 )] [node name="Engine4" parent="engines" instance=ExtResource( 10 )]
position = Vector2( -928, -224 ) position = Vector2( -928, -224 )
direction = 0 direction = 0
strength = 1.0
max_force = 0.05
[node name="Engine2" parent="engines" instance=ExtResource( 10 )] [node name="Engine2" parent="engines" instance=ExtResource( 10 )]
position = Vector2( -928, 160 ) position = Vector2( -928, 160 )
direction = 0 direction = 0
strength = 1.0
max_force = 0.05
[node name="Engine3" parent="engines" instance=ExtResource( 10 )] [node name="Engine3" parent="engines" instance=ExtResource( 10 )]
position = Vector2( -1024, 64 ) position = Vector2( -1024, 64 )
direction = 0 direction = 0
strength = 1.0
max_force = 0.05
[node name="objects" type="Node2D" parent="."] [node name="objects" type="Node2D" parent="."]
z_index = 10 z_index = 10
@ -140,12 +150,15 @@ position = Vector2( -704, 0 )
[node name="Door2" parent="objects" instance=ExtResource( 4 )] [node name="Door2" parent="objects" instance=ExtResource( 4 )]
position = Vector2( 608, 0 ) position = Vector2( 608, 0 )
object_name = "Bridge entrance"
[node name="Door4" parent="objects" instance=ExtResource( 4 )] [node name="Door4" parent="objects" instance=ExtResource( 4 )]
position = Vector2( 160, -128 ) position = Vector2( 160, -128 )
object_name = "Docking entrance B"
[node name="Door3" parent="objects" instance=ExtResource( 4 )] [node name="Door3" parent="objects" instance=ExtResource( 4 )]
position = Vector2( 96, -128 ) position = Vector2( 96, -128 )
object_name = "Docking entrance A"
[node name="Door5" parent="objects" instance=ExtResource( 4 )] [node name="Door5" parent="objects" instance=ExtResource( 4 )]
position = Vector2( 64, -320 ) position = Vector2( 64, -320 )
@ -218,21 +231,27 @@ position = Vector2( -352, 128 )
[node name="Door14" parent="objects" instance=ExtResource( 4 )] [node name="Door14" parent="objects" instance=ExtResource( 4 )]
position = Vector2( 352, 64 ) position = Vector2( 352, 64 )
object_name = "Medical entrance A"
[node name="Door15" parent="objects" instance=ExtResource( 4 )] [node name="Door15" parent="objects" instance=ExtResource( 4 )]
position = Vector2( 416, 64 ) position = Vector2( 416, 64 )
object_name = "Medical entrance B"
[node name="Door16" parent="objects" instance=ExtResource( 4 )] [node name="Door16" parent="objects" instance=ExtResource( 4 )]
position = Vector2( 256, 128 ) position = Vector2( 256, 128 )
object_name = "Medical Doubledoors A"
[node name="Door17" parent="objects" instance=ExtResource( 4 )] [node name="Door17" parent="objects" instance=ExtResource( 4 )]
position = Vector2( 256, 160 ) position = Vector2( 256, 160 )
object_name = "Medical Doubledoors B"
[node name="Door18" parent="objects" instance=ExtResource( 4 )] [node name="Door18" parent="objects" instance=ExtResource( 4 )]
position = Vector2( 416, -64 ) position = Vector2( 416, -64 )
object_name = "Armory entrance (Halls)"
[node name="Door19" parent="objects" instance=ExtResource( 4 )] [node name="Door19" parent="objects" instance=ExtResource( 4 )]
position = Vector2( 224, -160 ) position = Vector2( 224, -160 )
object_name = "Armory entrance (Docking)"
[node name="sockets" type="Node2D" parent="."] [node name="sockets" type="Node2D" parent="."]
z_index = 2 z_index = 2
@ -266,160 +285,199 @@ flow = 2
position = Vector2( -928, 96 ) position = Vector2( -928, 96 )
direction = 0 direction = 0
connectionPaths = [ NodePath("../../engines/Engine3") ] connectionPaths = [ NodePath("../../engines/Engine3") ]
flow = 1
[node name="ElectricSocket6" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket6" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -832, -192 ) position = Vector2( -832, -192 )
direction = 0 direction = 0
connectionPaths = [ NodePath("../../engines/Engine4") ] connectionPaths = [ NodePath("../../engines/Engine4") ]
flow = 1
[node name="ElectricSocket7" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket7" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -928, 0 ) position = Vector2( -928, 0 )
direction = 0 direction = 0
connectionPaths = [ NodePath("../../engines/Engine5") ] connectionPaths = [ NodePath("../../engines/Engine5") ]
flow = 1
[node name="ElectricSocket8" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket8" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -832, 192 ) position = Vector2( -832, 192 )
direction = 0 direction = 0
connectionPaths = [ NodePath("../../engines/Engine2") ] connectionPaths = [ NodePath("../../engines/Engine2") ]
flow = 1
[node name="ElectricSocket9" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket9" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -928, -96 ) position = Vector2( -928, -96 )
direction = 0 direction = 0
connectionPaths = [ NodePath("../../engines/Engine") ] connectionPaths = [ NodePath("../../engines/Engine") ]
flow = 1
[node name="ElectricSocket10" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket10" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 768, 0 ) position = Vector2( 768, 0 )
direction = 1 direction = 1
connectionPaths = [ NodePath("../../objects/Computer") ] connectionPaths = [ NodePath("../../objects/Computer") ]
flow = 1
[node name="ElectricSocket12" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket12" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 576, 0 ) position = Vector2( 576, 0 )
direction = 1 direction = 1
connectionPaths = [ NodePath("../../objects/Door2") ] connectionPaths = [ NodePath("../../objects/Door2") ]
flow = 1
[node name="ElectricSocket11" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket11" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -736, 0 ) position = Vector2( -736, 0 )
direction = 1 direction = 1
connectionPaths = [ NodePath("../../objects/Door") ] connectionPaths = [ NodePath("../../objects/Door") ]
flow = 1
[node name="ElectricSocket13" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket13" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 96, -96 ) position = Vector2( 96, -96 )
direction = 2 direction = 2
connectionPaths = [ NodePath("../../objects/Door3") ] connectionPaths = [ NodePath("../../objects/Door3") ]
flow = 1
[node name="ElectricSocket14" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket14" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 160, -96 ) position = Vector2( 160, -96 )
direction = 2 direction = 2
connectionPaths = [ NodePath("../../objects/Door4") ] connectionPaths = [ NodePath("../../objects/Door4") ]
flow = 1
[node name="ElectricSocket15" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket15" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 64, -224 ) position = Vector2( 64, -224 )
direction = 2 direction = 2
connectionPaths = [ NodePath("../../objects/Door7") ] connectionPaths = [ NodePath("../../objects/Door7") ]
flow = 1
[node name="ElectricSocket16" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket16" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 64, -288 ) position = Vector2( 64, -288 )
direction = 2 direction = 2
connectionPaths = [ NodePath("../../objects/Door5") ] connectionPaths = [ NodePath("../../objects/Door5") ]
flow = 1
[node name="ElectricSocket17" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket17" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 192, -288 ) position = Vector2( 192, -288 )
direction = 2 direction = 2
connectionPaths = [ NodePath("../../objects/Door6") ] connectionPaths = [ NodePath("../../objects/Door6") ]
flow = 1
[node name="ElectricSocket18" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket18" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 192, -224 ) position = Vector2( 192, -224 )
direction = 2 direction = 2
connectionPaths = [ NodePath("../../objects/Door8") ] connectionPaths = [ NodePath("../../objects/Door8") ]
flow = 1
[node name="ElectricSocket19" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket19" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -832, 0 ) position = Vector2( -832, 0 )
direction = 0 direction = 0
connectionPaths = [ NodePath("../../objects/Computer3") ] connectionPaths = [ NodePath("../../objects/Computer3") ]
flow = 1
[node name="ElectricSocket20" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket20" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -832, -32 ) position = Vector2( -832, -32 )
direction = 0 direction = 0
connectionPaths = [ NodePath("../../objects/Computer2") ] connectionPaths = [ NodePath("../../objects/Computer2") ]
flow = 1
[node name="ElectricSocket22" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket22" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 736, -64 ) position = Vector2( 736, -64 )
direction = 2 direction = 2
connectionPaths = [ NodePath("../../objects/Computer4") ] connectionPaths = [ NodePath("../../objects/Computer4") ]
flow = 1
[node name="ElectricSocket21" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket21" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 704, -64 ) position = Vector2( 704, -64 )
direction = 2 direction = 2
connectionPaths = [ NodePath("../../objects/Computer5") ] connectionPaths = [ NodePath("../../objects/Computer5") ]
flow = 1
[node name="ElectricSocket23" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket23" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 704, 64 ) position = Vector2( 704, 64 )
direction = 3
connectionPaths = [ NodePath("../../objects/Computer9") ] connectionPaths = [ NodePath("../../objects/Computer9") ]
flow = 1
[node name="ElectricSocket24" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket24" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 736, 64 ) position = Vector2( 736, 64 )
direction = 3
connectionPaths = [ NodePath("../../objects/Computer8") ] connectionPaths = [ NodePath("../../objects/Computer8") ]
flow = 1
[node name="ElectricSocket25" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket25" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 768, -32 ) position = Vector2( 768, -32 )
direction = 1 direction = 1
connectionPaths = [ NodePath("../../objects/Computer7") ] connectionPaths = [ NodePath("../../objects/Computer7") ]
flow = 1
[node name="ElectricSocket26" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket26" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 768, 32 ) position = Vector2( 768, 32 )
direction = 1 direction = 1
connectionPaths = [ NodePath("../../objects/Computer6") ] connectionPaths = [ NodePath("../../objects/Computer6") ]
flow = 1
[node name="ElectricSocket27" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket27" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -512, 224 ) position = Vector2( -512, 224 )
direction = 0 direction = 0
connectionPaths = [ NodePath("../../objects/Door9") ] connectionPaths = [ NodePath("../../objects/Door9") ]
flow = 1
[node name="ElectricSocket28" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket28" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -448, 32 ) position = Vector2( -448, 32 )
direction = 3
connectionPaths = [ NodePath("../../objects/Door10") ] connectionPaths = [ NodePath("../../objects/Door10") ]
flow = 1
[node name="ElectricSocket29" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket29" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -320, 128 ) position = Vector2( -320, 128 )
direction = 0 direction = 0
connectionPaths = [ NodePath("../../objects/Door12") ] connectionPaths = [ NodePath("../../objects/Door12") ]
flow = 1
[node name="ElectricSocket30" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket30" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -224, 32 ) position = Vector2( -224, 32 )
direction = 3
connectionPaths = [ NodePath("../../objects/Door11") ] connectionPaths = [ NodePath("../../objects/Door11") ]
flow = 1
[node name="ElectricSocket31" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket31" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -128, 192 ) position = Vector2( -128, 192 )
direction = 1 direction = 1
connectionPaths = [ NodePath("../../objects/Door13") ] connectionPaths = [ NodePath("../../objects/Door13") ]
flow = 1
[node name="ElectricSocket32" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket32" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 224, 128 ) position = Vector2( 224, 128 )
direction = 1 direction = 1
connectionPaths = [ NodePath("../../objects/Door16") ] connectionPaths = [ NodePath("../../objects/Door16") ]
flow = 1
[node name="ElectricSocket33" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket33" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 224, 160 ) position = Vector2( 224, 160 )
direction = 1 direction = 1
connectionPaths = [ NodePath("../../objects/Door17") ] connectionPaths = [ NodePath("../../objects/Door17") ]
flow = 1
[node name="ElectricSocket34" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket34" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 352, 32 ) position = Vector2( 352, 32 )
direction = 3
connectionPaths = [ NodePath("../../objects/Door14") ] connectionPaths = [ NodePath("../../objects/Door14") ]
flow = 1
[node name="ElectricSocket35" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket35" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 416, 32 ) position = Vector2( 416, 32 )
direction = 3
connectionPaths = [ NodePath("../../objects/Door15") ] connectionPaths = [ NodePath("../../objects/Door15") ]
flow = 1
[node name="ElectricSocket36" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket36" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 192, -160 ) position = Vector2( 192, -160 )
direction = 1 direction = 1
connectionPaths = [ NodePath("../../objects/Door19") ] connectionPaths = [ NodePath("../../objects/Door19") ]
flow = 1
[node name="ElectricSocket37" parent="sockets" instance=ExtResource( 14 )] [node name="ElectricSocket37" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 416, -32 ) position = Vector2( 416, -32 )
direction = 2 direction = 2
connectionPaths = [ NodePath("../../objects/Door18") ] connectionPaths = [ NodePath("../../objects/Door18") ]
flow = 1
[node name="lights" type="Node2D" parent="."] [node name="lights" type="Node2D" parent="."]
modulate = Color( 0.980392, 0.980392, 0.980392, 1 ) modulate = Color( 0.980392, 0.980392, 0.980392, 1 )
@ -436,6 +494,7 @@ z_index = 999
position = Vector2( 720, 16 ) position = Vector2( 720, 16 )
[node name="areas" type="Node2D" parent="."] [node name="areas" type="Node2D" parent="."]
visible = false
[node name="Bridge" parent="areas" instance=ExtResource( 8 )] [node name="Bridge" parent="areas" instance=ExtResource( 8 )]
position = Vector2( 752, 16 ) position = Vector2( 752, 16 )

View file

@ -127,9 +127,9 @@ __meta__ = {
[node name="PanelContainer" type="PanelContainer" parent="CenterContainer"] [node name="PanelContainer" type="PanelContainer" parent="CenterContainer"]
margin_left = 390.0 margin_left = 390.0
margin_top = 19.0 margin_top = 8.0
margin_right = 690.0 margin_right = 690.0
margin_bottom = 252.0 margin_bottom = 241.0
rect_min_size = Vector2( 300, 0 ) rect_min_size = Vector2( 300, 0 )
custom_styles/panel = SubResource( 5 ) custom_styles/panel = SubResource( 5 )

View file

@ -12,6 +12,8 @@ enum PopupName {
} }
onready var logs = $Logs onready var logs = $Logs
onready var inspect_box = $InspectBox as RichTextLabel
onready var scene = $"/root/scene" onready var scene = $"/root/scene"
onready var netgame = $"/root/Multiplayer" onready var netgame = $"/root/Multiplayer"
@ -19,12 +21,40 @@ const WHISPER_RADIUS = 32*3
const CHAT_RADIUS = 32*10 const CHAT_RADIUS = 32*10
const SHOUT_RADIUS = 32*14 const SHOUT_RADIUS = 32*14
var inspect_mode = false
var current_inspecting = null
func _ready() -> void: func _ready() -> void:
# Add options to menu buttons # Add options to menu buttons
var serverMenu = $Menu/Margins/Grid/Server.get_popup() var serverMenu = $Menu/Margins/Grid/Server.get_popup()
serverMenu.connect("id_pressed", self, "_server_option_chosen") serverMenu.connect("id_pressed", self, "_server_option_chosen")
serverMenu.add_item("Server info", ServerMenuItem.ServerInfo) serverMenu.add_item("Server info", ServerMenuItem.ServerInfo)
func _physics_process(_delta: float) -> void:
if inspect_mode:
var mouse_pos = scene.world.get_local_mouse_position() * scene.world.scale
var results = scene.physics.intersect_point(mouse_pos, 1, [], 2)
if results.size() > 0:
var obj = results[0].collider
if obj != current_inspecting:
current_inspecting = obj
if obj.has_method("inspect"):
var data = obj.inspect()
inspect_box.bbcode_text = ""
inspect_box.rect_size.y = 0
if "object_name" in obj and obj.object_name != "":
inspect_box.append_bbcode("[b]%s[/b] (%s)" % [obj.object_name, data.type])
else:
inspect_box.append_bbcode("A [b]%s[/b]" % data.type)
if "description" in data:
inspect_box.append_bbcode("\n" + data.description)
if "interaction" in data:
inspect_box.append_bbcode("\n\n[i]%s[/i]" % data.interaction)
inspect_box.visible = true
else:
current_inspecting = null
inspect_box.visible = false
func _server_option_chosen(id) -> void: func _server_option_chosen(id) -> void:
match id: match id:
ServerMenuItem.ServerInfo: ServerMenuItem.ServerInfo:
@ -55,3 +85,19 @@ func _send_chat(text: String) -> void:
scene.rpc("broadcast_zone", whisper_format % [netgame.player_name, escaped_text.substr(1)], scene.world.player.global_position, WHISPER_RADIUS) scene.rpc("broadcast_zone", whisper_format % [netgame.player_name, escaped_text.substr(1)], scene.world.player.global_position, WHISPER_RADIUS)
else: else:
scene.rpc("broadcast_zone", say_format % [netgame.player_name, escaped_text], scene.world.player.global_position, CHAT_RADIUS) scene.rpc("broadcast_zone", say_format % [netgame.player_name, escaped_text], scene.world.player.global_position, CHAT_RADIUS)
var inspect_offset = Vector2(20, 20)
func set_inspect(active: bool) -> void:
inspect_box.visible = inspect_box.visible and active
inspect_mode = active
inspect_box.rect_global_position = get_viewport().get_mouse_position() + inspect_offset
func _input(event: InputEvent) -> void:
if event.is_action_released("inspect"):
set_inspect(false)
elif event.is_action_pressed("inspect"):
set_inspect(true)
elif event is InputEventMouseMotion:
var mousemotion = event as InputEventMouseMotion
if inspect_mode:
inspect_box.rect_global_position = mousemotion.position + inspect_offset

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=2] [gd_scene load_steps=16 format=2]
[ext_resource path="res://Scenes/UI/SpaceMap.tscn" type="PackedScene" id=1] [ext_resource path="res://Scenes/UI/SpaceMap.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scenes/UI.gd" type="Script" id=2] [ext_resource path="res://Scenes/UI.gd" type="Script" id=2]
@ -43,6 +43,19 @@ corner_radius_top_right = 4
corner_radius_bottom_right = 4 corner_radius_bottom_right = 4
corner_radius_bottom_left = 4 corner_radius_bottom_left = 4
[sub_resource type="StyleBoxFlat" id=6]
bg_color = Color( 0.133333, 0.12549, 0.203922, 0.705882 )
border_width_left = 4
border_width_top = 4
border_width_right = 4
border_width_bottom = 4
border_color = Color( 0.0941176, 0.0823529, 0.180392, 1 )
border_blend = true
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
[node name="ui" type="Control"] [node name="ui" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
@ -153,10 +166,29 @@ margin_bottom = 20.0
text = "Preferences" text = "Preferences"
[node name="ServerInfoPopup" parent="." instance=ExtResource( 4 )] [node name="ServerInfoPopup" parent="." instance=ExtResource( 4 )]
visible = false
margin_left = 31.2773 margin_left = 31.2773
margin_top = 46.9222 margin_top = 46.9222
margin_right = 287.277 margin_right = 287.277
margin_bottom = 214.923 margin_bottom = 214.923
[node name="InspectBox" type="RichTextLabel" parent="."]
margin_left = 19.0
margin_top = -124.0
margin_right = 376.0
margin_bottom = -97.0
size_flags_horizontal = 15
size_flags_vertical = 15
custom_styles/normal = SubResource( 6 )
custom_fonts/bold_italics_font = SubResource( 1 )
custom_fonts/italics_font = SubResource( 2 )
custom_fonts/bold_font = SubResource( 3 )
custom_fonts/normal_font = SubResource( 4 )
fit_content_height = true
scroll_active = false
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="chat_message_sent" from="Logs" to="." method="_send_chat"] [connection signal="chat_message_sent" from="Logs" to="." method="_send_chat"]
[connection signal="focus_entered" from="Logs/ResizablePanel/LineEdit" to="Logs" method="_chat_bar_status" binds= [ true ]] [connection signal="focus_entered" from="Logs/ResizablePanel/LineEdit" to="Logs" method="_chat_bar_status" binds= [ true ]]
[connection signal="focus_exited" from="Logs/ResizablePanel/LineEdit" to="Logs" method="_chat_bar_status" binds= [ false ]] [connection signal="focus_exited" from="Logs/ResizablePanel/LineEdit" to="Logs" method="_chat_bar_status" binds= [ false ]]

View file

@ -226,11 +226,16 @@ ui_chat={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":84,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":84,"unicode":0,"echo":false,"script":null)
] ]
} }
inspect={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"unicode":0,"echo":false,"script":null)
]
}
[layer_names] [layer_names]
2d_physics/layer_1="Environment" 2d_physics/layer_1="Environment"
2d_physics/layer_2="Projectile" 2d_physics/layer_2="Objects"
2d_physics/layer_3="Electric" 2d_physics/layer_3="Electric"
2d_physics/layer_4="Actors" 2d_physics/layer_4="Actors"
2d_physics/layer_5="AreaBound" 2d_physics/layer_5="AreaBound"