Add more NPCs, update dialogue manager to 4.4 compatible version
This commit is contained in:
@@ -7,6 +7,7 @@ const SUPPORTED_BUILTIN_TYPES = [
|
||||
TYPE_STRING,
|
||||
TYPE_STRING_NAME,
|
||||
TYPE_ARRAY,
|
||||
TYPE_PACKED_STRING_ARRAY,
|
||||
TYPE_VECTOR2,
|
||||
TYPE_VECTOR3,
|
||||
TYPE_VECTOR4,
|
||||
@@ -21,13 +22,37 @@ const SUPPORTED_BUILTIN_TYPES = [
|
||||
static var resolve_method_error: Error = OK
|
||||
|
||||
|
||||
static func is_supported(thing) -> bool:
|
||||
return typeof(thing) in SUPPORTED_BUILTIN_TYPES
|
||||
static func is_supported(thing, with_method: String = "") -> bool:
|
||||
if not typeof(thing) in SUPPORTED_BUILTIN_TYPES: return false
|
||||
|
||||
# If given a Dictionary and a method then make sure it's a known Dictionary method.
|
||||
if typeof(thing) == TYPE_DICTIONARY and with_method != "":
|
||||
return with_method in [
|
||||
&"clear",
|
||||
&"duplicate",
|
||||
&"erase",
|
||||
&"find_key",
|
||||
&"get",
|
||||
&"get_or_add",
|
||||
&"has",
|
||||
&"has_all",
|
||||
&"hash",
|
||||
&"is_empty",
|
||||
&"is_read_only",
|
||||
&"keys",
|
||||
&"make_read_only",
|
||||
&"merge",
|
||||
&"merged",
|
||||
&"recursive_equal",
|
||||
&"size",
|
||||
&"values"]
|
||||
|
||||
return true
|
||||
|
||||
|
||||
static func resolve_property(builtin, property: String):
|
||||
match typeof(builtin):
|
||||
TYPE_ARRAY, TYPE_DICTIONARY, TYPE_QUATERNION, TYPE_STRING, TYPE_STRING_NAME:
|
||||
TYPE_ARRAY, TYPE_PACKED_STRING_ARRAY, TYPE_DICTIONARY, TYPE_QUATERNION, TYPE_STRING, TYPE_STRING_NAME:
|
||||
return builtin[property]
|
||||
|
||||
# Some types have constants that we need to manually resolve
|
||||
@@ -406,6 +431,15 @@ static func resolve_vector2_property(vector: Vector2, property: String):
|
||||
"DOWN":
|
||||
return Vector2.DOWN
|
||||
|
||||
"DOWN_LEFT":
|
||||
return Vector2(-1, 1)
|
||||
"DOWN_RIGHT":
|
||||
return Vector2(1, 1)
|
||||
"UP_LEFT":
|
||||
return Vector2(-1, -1)
|
||||
"UP_RIGHT":
|
||||
return Vector2(1, -1)
|
||||
|
||||
return vector[property]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user