mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-18 14:07:17 +01:00
Now the visibility/lod/wakeup check has a timer for mobs.
This commit is contained in:
parent
b4867ec012
commit
6b50033f29
@ -161,7 +161,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.04, -0.09 )
|
|||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="RightHandAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="2"]
|
[node name="RightHandAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="2"]
|
||||||
transform = Transform( -0.0400955, -0.0242102, -0.998884, -0.127471, -0.991364, 0.0291306, -0.991041, 0.128501, 0.0366712, -0.226341, 0.768569, -0.00640216 )
|
transform = Transform( -0.0400954, -0.0242101, -0.998884, -0.127471, -0.991364, 0.0291305, -0.991041, 0.128501, 0.0366712, -0.226341, 0.768569, -0.00640216 )
|
||||||
bone_name = "right_hand"
|
bone_name = "right_hand"
|
||||||
|
|
||||||
[node name="RightHandAP" type="Spatial" parent="armature/Armature/Skeleton/RightHandAttachment"]
|
[node name="RightHandAP" type="Spatial" parent="armature/Armature/Skeleton/RightHandAttachment"]
|
||||||
@ -177,7 +177,7 @@ transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0
|
|||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="NeckAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="4"]
|
[node name="NeckAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="4"]
|
||||||
transform = Transform( 0.99998, -0.00629028, -0.000312272, 0.00629784, 0.997246, 0.0731527, -0.000148758, -0.0731576, 0.99732, 0.00103962, 1.31823, 5.39595e-05 )
|
transform = Transform( 0.99998, -0.00629028, -0.000312272, 0.00629784, 0.997246, 0.0731527, -0.000148758, -0.0731576, 0.99732, 0.00103962, 1.31823, 5.39597e-05 )
|
||||||
bone_name = "neck"
|
bone_name = "neck"
|
||||||
|
|
||||||
[node name="TorsoAP" type="Spatial" parent="armature/Armature/Skeleton/NeckAttachment"]
|
[node name="TorsoAP" type="Spatial" parent="armature/Armature/Skeleton/NeckAttachment"]
|
||||||
|
@ -78,6 +78,7 @@ var moving : bool = false
|
|||||||
var casting_anim : bool = false
|
var casting_anim : bool = false
|
||||||
|
|
||||||
var sleep : bool = false
|
var sleep : bool = false
|
||||||
|
var sleep_recheck_timer : float = 0
|
||||||
var dead : bool = false
|
var dead : bool = false
|
||||||
var death_timer : float = 0
|
var death_timer : float = 0
|
||||||
|
|
||||||
@ -89,6 +90,8 @@ var entity : Entity
|
|||||||
var model_rotation_node : Spatial
|
var model_rotation_node : Spatial
|
||||||
var character_skeleton : CharacterSkeleton3D
|
var character_skeleton : CharacterSkeleton3D
|
||||||
|
|
||||||
|
var visibility_update_timer : float = 0
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
camera = get_node_or_null("CameraPivot/Camera") as Camera
|
camera = get_node_or_null("CameraPivot/Camera") as Camera
|
||||||
camera_pivot = get_node_or_null("CameraPivot") as Spatial
|
camera_pivot = get_node_or_null("CameraPivot") as Spatial
|
||||||
@ -125,6 +128,13 @@ func _enter_tree():
|
|||||||
func _process(delta : float) -> void:
|
func _process(delta : float) -> void:
|
||||||
if entity.ai_state == EntityEnums.AI_STATE_OFF:
|
if entity.ai_state == EntityEnums.AI_STATE_OFF:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
visibility_update_timer += delta
|
||||||
|
|
||||||
|
if visibility_update_timer < 1:
|
||||||
|
return
|
||||||
|
|
||||||
|
visibility_update_timer = 0
|
||||||
|
|
||||||
var camera : Camera = get_tree().get_root().get_camera() as Camera
|
var camera : Camera = get_tree().get_root().get_camera() as Camera
|
||||||
|
|
||||||
@ -167,10 +177,18 @@ func _physics_process(delta : float) -> void:
|
|||||||
if dead:
|
if dead:
|
||||||
return
|
return
|
||||||
|
|
||||||
if entity.ai_state == EntityEnums.AI_STATE_OFF:
|
if entity.c_is_controlled:
|
||||||
process_input(delta)
|
process_input(delta)
|
||||||
process_movement_player(delta)
|
process_movement_player(delta)
|
||||||
else:
|
else:
|
||||||
|
if sleep:
|
||||||
|
sleep_recheck_timer += delta
|
||||||
|
|
||||||
|
if sleep_recheck_timer < 0.5:
|
||||||
|
return
|
||||||
|
|
||||||
|
sleep_recheck_timer = 0
|
||||||
|
|
||||||
if world != null:
|
if world != null:
|
||||||
if not world.is_position_walkable(transform.origin):
|
if not world.is_position_walkable(transform.origin):
|
||||||
return
|
return
|
||||||
@ -319,7 +337,7 @@ func process_movement_mob(delta : float) -> void:
|
|||||||
|
|
||||||
if not moving and sleep:
|
if not moving and sleep:
|
||||||
return
|
return
|
||||||
|
|
||||||
if moving and sleep:
|
if moving and sleep:
|
||||||
sleep = false
|
sleep = false
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@ max_frame_chunk_build_steps = 4
|
|||||||
library = ExtResource( 2 )
|
library = ExtResource( 2 )
|
||||||
level_generator = SubResource( 1 )
|
level_generator = SubResource( 1 )
|
||||||
voxel_scale = 3.0
|
voxel_scale = 3.0
|
||||||
chunk_spawn_range = 5
|
|
||||||
build_flags = 511
|
build_flags = 511
|
||||||
script = ExtResource( 8 )
|
script = ExtResource( 8 )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user