Add NPC class which Meldewesen now inherits from

This is in preparation for being able to more finely control the NPC,
both from the specific NPC implementation and the PathNavigator (which
was renamed accordingly)
This commit is contained in:
karl 2019-11-11 10:24:29 +01:00
parent f67b7e6361
commit 93f59ec131
6 changed files with 17 additions and 8 deletions

View File

@ -1,4 +1,4 @@
extends KinematicBody extends NPC
export(NodePath) var _visibility_path: NodePath export(NodePath) var _visibility_path: NodePath

2
Characters/NPC.gd Normal file
View File

@ -0,0 +1,2 @@
extends KinematicBody
class_name NPC

View File

@ -11,7 +11,7 @@ export(float) var speed = 8
export(NodePath) var body_nodepath export(NodePath) var body_nodepath
var navigation: Navigation var navigation: Navigation
var body: KinematicBody var body: NPC
# React to the NodeGroupNotifier of the Navigation # React to the NodeGroupNotifier of the Navigation

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://Characters/Util/PathNavigatorForKinematicBody.gd" type="Script" id=1] [ext_resource path="res://Characters/Util/PathNavigatorForNPC.gd" type="Script" id=1]
[sub_resource type="Curve3D" id=1] [sub_resource type="Curve3D" id=1]
_data = { _data = {
@ -8,7 +8,7 @@ _data = {
"tilts": PoolRealArray( 0, 0, 0, 0 ) "tilts": PoolRealArray( 0, 0, 0, 0 )
} }
[node name="PathNavigatorForKinematicBody" type="Path" groups=[ [node name="PathNavigatorForNPC" type="Path" groups=[
"Navigator", "Navigator",
]] ]]
curve = SubResource( 1 ) curve = SubResource( 1 )

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=12 format=2] [gd_scene load_steps=12 format=2]
[ext_resource path="res://Characters/Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://Characters/Player/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://Characters/Util/PathNavigatorForKinematicBody.tscn" type="PackedScene" id=2] [ext_resource path="res://Characters/Util/PathNavigatorForNPC.tscn" type="PackedScene" id=2]
[ext_resource path="res://Characters/Meldewesen/Meldewesen.tscn" type="PackedScene" id=3] [ext_resource path="res://Characters/Meldewesen/Meldewesen.tscn" type="PackedScene" id=3]
[ext_resource path="res://Util/NodeGroupNotifier.tscn" type="PackedScene" id=4] [ext_resource path="res://Util/NodeGroupNotifier.tscn" type="PackedScene" id=4]
@ -74,11 +74,12 @@ shape = SubResource( 6 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 )
shape = SubResource( 7 ) shape = SubResource( 7 )
[node name="PathNavigatorForKinematicBody" parent="." instance=ExtResource( 2 )] [node name="MeldewesenNavigator" parent="." instance=ExtResource( 2 )]
speed = 3.0 speed = 3.0
body_nodepath = NodePath("Meldewesen") body_nodepath = NodePath("../MeldewesenNavigator/Meldewesen")
[node name="Meldewesen" parent="PathNavigatorForKinematicBody" instance=ExtResource( 3 )] [node name="Meldewesen" parent="MeldewesenNavigator" instance=ExtResource( 3 )]
_visibility_path = NodePath("../../MeldewesenNavigator/Meldewesen/Visibility")
[node name="NodeGroupNotifier" parent="." instance=ExtResource( 4 )] [node name="NodeGroupNotifier" parent="." instance=ExtResource( 4 )]
group_name = "Navigator" group_name = "Navigator"

View File

@ -39,6 +39,11 @@ _global_script_classes=[ {
"language": "GDScript", "language": "GDScript",
"path": "res://Util/gs-logger-3.1-R3/gs_logger/message.gd" "path": "res://Util/gs-logger-3.1-R3/gs_logger/message.gd"
}, { }, {
"base": "KinematicBody",
"class": "NPC",
"language": "GDScript",
"path": "res://Characters/NPC.gd"
}, {
"base": "Layout", "base": "Layout",
"class": "PatternLayout", "class": "PatternLayout",
"language": "GDScript", "language": "GDScript",
@ -51,6 +56,7 @@ _global_script_class_icons={
"HtmlLayout": "", "HtmlLayout": "",
"Layout": "", "Layout": "",
"Message": "", "Message": "",
"NPC": "",
"PatternLayout": "" "PatternLayout": ""
} }