Fix typos in beginner tutorial - twitch combat
This commit is contained in:
parent
d6d3fd3424
commit
83226c583c
1 changed files with 23 additions and 23 deletions
|
|
@ -259,7 +259,7 @@ class EvAdventureCombatTwitchHandler(EvAdventureCombatBaseHandler):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if action_dict["key"] not in self.action_classes:
|
if action_dict["key"] not in self.action_classes:
|
||||||
self.obj.msg("This is an unkown action!")
|
self.obj.msg("This is an unknown action!")
|
||||||
return
|
return
|
||||||
|
|
||||||
# store action dict and schedule it to run in dt time
|
# store action dict and schedule it to run in dt time
|
||||||
|
|
@ -285,7 +285,7 @@ class EvAdventureCombatTwitchHandler(EvAdventureCombatBaseHandler):
|
||||||
- **Line 43**: We simply store the given action dict in the Attribute `action_dict` on the handler. Simple and effective!
|
- **Line 43**: We simply store the given action dict in the Attribute `action_dict` on the handler. Simple and effective!
|
||||||
- **Line 44**: When you enter e.g. `attack`, you expect in this type of combat to see the `attack` command repeat automatically even if you don't enter anything more. To this end we are looking for a new key in action dicts, indicating that this action should _repeat_ with a certain rate (`dt`, given in seconds). We make this compatible with all action dicts by simply assuming it's zero if not specified.
|
- **Line 44**: When you enter e.g. `attack`, you expect in this type of combat to see the `attack` command repeat automatically even if you don't enter anything more. To this end we are looking for a new key in action dicts, indicating that this action should _repeat_ with a certain rate (`dt`, given in seconds). We make this compatible with all action dicts by simply assuming it's zero if not specified.
|
||||||
|
|
||||||
[evennia.utils.utils.repeat](evennia.utils.utils.repeat) and [evennia.utils.utils.unrepeat](evennia.utils.utils.unrepeat) are convenient shortcuts to the [TickerHandler](../../../Components/TickerHandler.md). You tell `repeat` to call a given method/function at a certain rate. What you get back is a reference that you can then later use to 'un-repeat' (stop the repeating) later. We make sure to store this reference (we don't care exactly how it looks, just that we need to store it) in `the current_ticket_ref` Attribute (**Line 26**).
|
[evennia.utils.utils.repeat](evennia.utils.utils.repeat) and [evennia.utils.utils.unrepeat](evennia.utils.utils.unrepeat) are convenient shortcuts to the [TickerHandler](../../../Components/TickerHandler.md). You tell `repeat` to call a given method/function at a certain rate. What you get back is a reference that you can then later use to 'un-repeat' (stop the repeating) later. We make sure to store this reference (we don't care exactly how it looks, just that we need to store it) in the `current_ticker_ref` Attribute (**Line 26**).
|
||||||
|
|
||||||
- **Line 48**: Whenever we queue a new action (it may replace an existing one) we must make sure to kill (un-repeat) any old repeats that are ongoing. Otherwise we would get old actions firing over and over and new ones starting alongside them.
|
- **Line 48**: Whenever we queue a new action (it may replace an existing one) we must make sure to kill (un-repeat) any old repeats that are ongoing. Otherwise we would get old actions firing over and over and new ones starting alongside them.
|
||||||
- **Line 49**: If `dt` is set, we call `repeat` to set up a new repeat action at the given rate. We store this new reference. After `dt` seconds, the `.execute_next_action` method will fire (we'll create that in the next section).
|
- **Line 49**: If `dt` is set, we call `repeat` to set up a new repeat action at the given rate. We store this new reference. After `dt` seconds, the `.execute_next_action` method will fire (we'll create that in the next section).
|
||||||
|
|
@ -328,7 +328,7 @@ class EvAdventureCombatTwitchHandler(EvAdventureCombatBaseHandler):
|
||||||
This is the method called after `dt` seconds in `queue_action`.
|
This is the method called after `dt` seconds in `queue_action`.
|
||||||
|
|
||||||
- **Line 5**: We defined a 'fallback action'. This is used after a one-time action (one that should not repeat) has completed.
|
- **Line 5**: We defined a 'fallback action'. This is used after a one-time action (one that should not repeat) has completed.
|
||||||
- **Line 15**: We take the `'key'` from the `action-dict` and use the `action_classes` mapping to get an action class (e.g. `ACtionAttack` we defined [here](./Beginner-Tutorial-Combat-Base.md#attack-action)).
|
- **Line 15**: We take the `'key'` from the `action_dict` and use the `action_classes` mapping to get an action class (e.g. `ActionAttack` we defined [here](./Beginner-Tutorial-Combat-Base.md#attack-action)).
|
||||||
- **Line 16**: Here we initialize the action class with the actual current data - the combatant and the `action_dict`. This calls the `__init__` method on the class and makes the action ready to use.
|
- **Line 16**: Here we initialize the action class with the actual current data - the combatant and the `action_dict`. This calls the `__init__` method on the class and makes the action ready to use.
|
||||||
```{sidebar} New action-dict keys
|
```{sidebar} New action-dict keys
|
||||||
To summarize, for twitch-combat use we have now introduced two new keys to action-dicts:
|
To summarize, for twitch-combat use we have now introduced two new keys to action-dicts:
|
||||||
|
|
@ -384,7 +384,7 @@ We must make sure to check if combat is over.
|
||||||
- **Line 12**: With our `.get_sides()` method we can easily get the two sides of the conflict.
|
- **Line 12**: With our `.get_sides()` method we can easily get the two sides of the conflict.
|
||||||
- **Lines 18, 19**: We get everyone still alive _and still in the same room_. The latter condition is important in case we move away from the battle - you can't hit your enemy from another room.
|
- **Lines 18, 19**: We get everyone still alive _and still in the same room_. The latter condition is important in case we move away from the battle - you can't hit your enemy from another room.
|
||||||
|
|
||||||
In the `stop_method` we'll need to do a bunch of cleanup. We'll hold off on implementing this until we have the Commands written out. Read on.
|
In the `stop_combat` method we'll need to do a bunch of cleanup. We'll hold off on implementing this until we have the Commands written out. Read on.
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue