Update ESS to get the body_changed signal. NamePlates now automatically hide themselves when an entity's body gets hidden.

This commit is contained in:
Relintai 2020-07-29 15:35:48 +02:00
parent 485d2c3124
commit 92c7bd803e
4 changed files with 43 additions and 3 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "bc2ee7171a29d02a4687eaddd91374e127cf2b88"}, "entity_spell_system": {"master": "e45d109d7f366a22a8e39c90ab9898741ca38182"}, "ui_extensions": {"master": "6db99122c27e87840f2da2cfa8934b0d0510004e"}, "voxelman": {"master": "768728139ede479dad006913e2f86d3f85edae57"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "a9bab9896de71966b9c9056869871e618c64cba7"}, "procedural_animations": {"master": "8426e2c976e9f9cb82bca636c0ec6e79ad7b3bcb"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "0ed644e4a4e7867a49fbe7c727b500305f7077f8"}, "mesh_utils": {"master": "65a802ff39a601bd1a55675023871e09500943ef"}, "broken_seals_module": {"master": "8c4b32d3932ccb043b8f6c92c1277547750fe391"}, "thread_pool": {"master": "164ad82feb05842cb944c2907b65e521f8c7c465"}}
{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "bc2ee7171a29d02a4687eaddd91374e127cf2b88"}, "entity_spell_system": {"master": "2c7a982a28b7e037302db5450b20a0dc9c49e81c"}, "ui_extensions": {"master": "6db99122c27e87840f2da2cfa8934b0d0510004e"}, "voxelman": {"master": "768728139ede479dad006913e2f86d3f85edae57"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "a9bab9896de71966b9c9056869871e618c64cba7"}, "procedural_animations": {"master": "8426e2c976e9f9cb82bca636c0ec6e79ad7b3bcb"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "0ed644e4a4e7867a49fbe7c727b500305f7077f8"}, "mesh_utils": {"master": "65a802ff39a601bd1a55675023871e09500943ef"}, "broken_seals_module": {"master": "8c4b32d3932ccb043b8f6c92c1277547750fe391"}, "thread_pool": {"master": "164ad82feb05842cb944c2907b65e521f8c7c465"}}

View File

@ -11,6 +11,8 @@ height = 0.927641
extents = Vector3( 0.216228, 0.0681041, 0.183397 )
[node name="HumanFemale" type="KinematicBody"]
collision_layer = 2147483650
collision_mask = 3
script = ExtResource( 1 )
max_visible_distance = 70.0
model_path = NodePath("../HumanFemale/Rotation_Helper/Model")

View File

@ -93,6 +93,8 @@ var character_skeleton : CharacterSkeleton3D
var visibility_update_timer : float = 0
var placed : bool = false
#var los : bool = false
func _ready() -> void:
camera = get_node_or_null("CameraPivot/Camera") as Camera
camera_pivot = get_node_or_null("CameraPivot") as Spatial
@ -198,6 +200,16 @@ func _physics_process(delta : float) -> void:
process_input(delta)
process_movement_player(delta)
else:
# var camera : Camera = get_tree().get_root().get_camera() as Camera
#
# if camera != null:
# var res = get_world().get_direct_space_state().intersect_ray(get_transform().origin, camera.transform.origin, [ self ], 1)
#
# if res:
# los = true
# else:
# los = false
if sleep:
sleep_recheck_timer += delta

View File

@ -44,10 +44,16 @@ var health_bar : TextureProgress = null
var health_bar_label : Label = null
var entity : Entity = null
var entity_body : Node = null
var health : EntityResource = null
var _health : EntityResource
var body_visibility : bool = true
func _init():
set_process(false)
func _enter_tree():
name_label = get_node(name_label_path) as Label
health_bar = get_node(health_bar_path) as TextureProgress
@ -55,7 +61,8 @@ func _enter_tree():
entity = get_node("../..") as Entity
entity.connect("centity_resource_added", self, "on_centity_resource_added")
entity_body = entity.get_body()
name_label.text = entity.centity_name
entity.connect("cname_changed", self, "cname_changed")
@ -63,6 +70,7 @@ func _enter_tree():
entity.connect("notification_cmouse_exited", self, "onc_entity_mouse_exited")
entity.connect("notification_ctargeted", self, "notification_ctargeted")
entity.connect("notification_cuntargeted", self, "notification_cuntargeted")
entity.connect("body_changed", self, "_body_changed")
modulate = normal_color
set_scale(normal_scale)
@ -70,9 +78,11 @@ func _enter_tree():
target_scale = normal_scale
interpolating = false
set_process(true)
_on_body_visibility_changed()
func _process(delta):
assert(body_visibility)
if interpolating:
var d : Vector2 = ((target_scale - get_scale()).normalized() * delta) + get_scale()
@ -177,3 +187,19 @@ func on_centity_resource_added(resorce) -> void:
_health = entity.getc_health()
_health.connect("changed", self, "c_health_changed")
c_health_changed()
func _body_changed(ent):
entity_body = entity.get_body()
if entity_body && entity_body.has_signal("visibility_changed"):
entity_body.connect("visibility_changed", self, "_on_body_visibility_changed")
else:
_on_body_visibility_changed()
func _on_body_visibility_changed():
if entity_body:
body_visibility = entity_body.visible
else:
body_visibility = true
set_process(body_visibility)