Small fixes and issue 386 (#387)

Co-authored-by: Dennis Ploeger <develop@dieploegers.de>
Co-authored-by: dploeger <dploeger@users.noreply.github.com>
This commit is contained in:
Dennis Ploeger
2021-09-07 08:07:10 +02:00
committed by GitHub
parent 3ee46f4977
commit 903422960a
12 changed files with 94 additions and 14 deletions

View File

@@ -285,7 +285,6 @@ func walk_stop(pos: Vector2) -> void:
update_terrain()
yield(parent.get_animation_player(), "animation_finished")
if walk_context.target_object:
escoria.logger.debug(
"%s arrived at %s" % [

View File

@@ -0,0 +1,45 @@
# `set_animations object animations`
#
# Set the animation resource for the given ESCPlayer
#
# @ESC
extends ESCBaseCommand
class_name SetAnimationsCommand
# Return the descriptor of the arguments of this command
func configure() -> ESCCommandArgumentDescriptor:
return ESCCommandArgumentDescriptor.new(
2,
[TYPE_STRING, TYPE_STRING],
[null, null]
)
# Validate wether the given arguments match the command descriptor
func validate(arguments: Array):
if not escoria.object_manager.objects.has(arguments[0]):
escoria.logger.report_errors(
"set_animations: invalid object",
[
"Object with global id %s not found" % arguments[0]
]
)
return false
if not ResourceLoader.exists(arguments[1]):
escoria.logger.report_errors(
"set_animations: invalid animations",
[
"The animation resource %s was not found" % arguments[1]
]
)
return false
return .validate(arguments)
# Run the command
func run(command_params: Array) -> int:
(escoria.object_manager.get_object(command_params[0]).node as ESCPlayer)\
.animations = load(command_params[1])
return ESCExecution.RC_OK

View File

@@ -5,7 +5,6 @@
# It does not respect the room's navigation polygons, so you can move items
# where the player can't walk.
#
# @STUB
# @ESC
extends ESCBaseCommand
class_name SlideCommand

View File

@@ -5,7 +5,6 @@
# It does not respect the room's navigation polygons, so you can move items
# where the player can't walk.
#
# @STUB
# @ESC
extends SlideCommand
class_name SlideBlockCommand

View File

@@ -10,7 +10,6 @@
# Set immediate to true to show directly switch to the direction and not
# show intermediate angles
#
# @STUB
# @ESC
extends ESCBaseCommand
class_name TurnToCommand

View File

@@ -146,7 +146,7 @@ Walk to a given position
### walk\_stop
```gdscript
func walk_stop(pos: Vector2) -> var
func walk_stop(pos: Vector2) -> void
```
We have finished walking. Set the idle pose and complete

View File

@@ -0,0 +1,39 @@
<!-- Auto-generated from JSON by GDScript docs maker. Do not edit this document directly. -->
# SetAnimationsCommand
**Extends:** [ESCBaseCommand](../ESCBaseCommand) < [Node](../Node)
## Description
`set_animations object animations`
Set the animation resource for the given ESCPlayer
@ESC
## Method Descriptions
### configure
```gdscript
func configure() -> ESCCommandArgumentDescriptor
```
Return the descriptor of the arguments of this command
### validate
```gdscript
func validate(arguments: Array)
```
Validate wether the given arguments match the command descriptor
### run
```gdscript
func run(command_params: Array) -> int
```
Run the command

View File

@@ -13,7 +13,6 @@ object1's "speed" property, unless overridden. This command is blocking.
It does not respect the room's navigation polygons, so you can move items
where the player can't walk.
@STUB
@ESC
## Method Descriptions

View File

@@ -13,7 +13,6 @@ object1's "speed" property, unless overridden. This command is non-blocking.
It does not respect the room's navigation polygons, so you can move items
where the player can't walk.
@STUB
@ESC
## Method Descriptions

View File

@@ -18,7 +18,6 @@ be between [0, 360] or an error is reported.
Set immediate to true to show directly switch to the direction and not
show intermediate angles
@STUB
@ESC
## Method Descriptions

View File

@@ -281,6 +281,9 @@ destination angle, animations are played if they're defined in animations.
object must be player or interactive. degrees must be between [0, 360] or an
error is reported.
#### <a name="SetAnimationsCommand.md"></a>`set_animations object animations` [API-Doc](api/SetAnimationsCommand.md)
Set the animation resource for the given ESCPlayer
#### <a name="SetGlobalCommand.md"></a>`set_global name value` [API-Doc](api/SetGlobalCommand.md)
Changes the value of the global "name" with the value. Value can be "true",
@@ -318,16 +321,12 @@ character.
If `immediate` is set to true, the animation is run directly
#### <a name="SlideBlockCommand.md"></a>`slide_block object1 object2 [speed]` [API-Doc](api/SlideBlockCommand.md)
**This command is currently not fully implemented.**
Moves object1 towards the position of object2, at the speed determined by
object1's "speed" property, unless overridden. This command is blocking.
It does not respect the room's navigation polygons, so you can move items
where the player can't walk.
#### <a name="SlideCommand.md"></a>`slide object1 object2 [speed]` [API-Doc](api/SlideCommand.md)
**This command is currently not fully implemented.**
Moves object1 towards the position of object2, at the speed determined by
object1's "speed" property, unless overridden. This command is non-blocking.
It does not respect the room's navigation polygons, so you can move items
@@ -347,8 +346,6 @@ Sets the position of object1 to the position of object2.
Sets the position of object1 to the position (x,y).
#### <a name="TurnToCommand.md"></a>`turn_to object degrees [immediate]` [API-Doc](api/TurnToCommand.md)
**This command is currently not fully implemented.**
Turns object to a degrees angle with a directions animation.
0 sets object facing forward, 90 sets it 90 degrees clockwise ("east") etc.

View File

@@ -395,6 +395,11 @@ _global_script_classes=[ {
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/set_angle.gd"
}, {
"base": "ESCBaseCommand",
"class": "SetAnimationsCommand",
"language": "GDScript",
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/set_animations.gd"
}, {
"base": "ESCBaseCommand",
"class": "SetGlobalCommand",
"language": "GDScript",
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/set_global.gd"
@@ -567,6 +572,7 @@ _global_script_class_icons={
"SchedEventCommand": "",
"SetActiveCommand": "",
"SetAngleCommand": "",
"SetAnimationsCommand": "",
"SetGlobalCommand": "",
"SetGlobalsCommand": "",
"SetHudVisibleCommand": "",