Skip to content

Commit

Permalink
added inline documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevertus committed Jul 3, 2019
1 parent d208776 commit 963ac71
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .packages
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by pub on 2019-07-03 15:04:20.444694.
# Generated by pub on 2019-07-03 15:14:24.508408.
async:file:///C:/Users/Marten/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/async-2.0.8/lib/
collection:file:///C:/Users/Marten/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/collection-1.14.11/lib/
colorize:file:///C:/Users/Marten/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/colorize-2.0.0/lib/
Expand Down
27 changes: 27 additions & 0 deletions lib/basic/module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@ import 'package:objd/basic/file.dart';
import 'package:objd/basic/widget.dart';
import 'package:objd/build/context.dart';


/// A Module extends the functionality of a Widget. It allows deeper intregration and file generation.
///
/// The Module is therefore mostly used in your tick function or with the modules provider of the Pack.
///
/// It is supposed to make the concept of animations, timers and continuous ticks easier and gives an high level interface to add complex operations to objD.
///
/// ### Definition
/// A Module has like a Widget a generate method to return the underlying tree and a registerFiles method.
///
/// ```dart
/// class ExampleModule extends Module {
/// Widget generate(Context context){
/// return ...
/// }
/// List<File> registerFiles(){
/// return [
/// File(...)
/// ...
/// ]
/// }
/// }
/// ```
/// The registered files are just added to the pack as if they were defined in it or in the Widget tree.
///
/// A Module can still be used as a widget everywhere and also handles conditions and groups.
abstract class Module extends Widget {
Widget generate(Context context);
List<File> registerFiles();
Expand Down
28 changes: 28 additions & 0 deletions lib/modules/score_timer.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:meta/meta.dart';
import 'package:objd/core.dart';

/// The ScoreTimerModule implements a continuous timer with a delay of a number of ticks. It therefore uses a Score to count up or down in steps and resets to the start value afterwards.
class ScoreTimerModule extends Module {
Score _score;
String name;
Expand All @@ -11,6 +12,33 @@ class ScoreTimerModule extends Module {
int ticks;
int start;


/// The ScoreTimerModule implements a continuous timer with a delay of a number of ticks. It therefore uses a Score to count up or down in steps and resets to the start value afterwards.
///
/// > To work probably this has to be executed every tick or added to the Packs modules.
///
/// | constructor | |
/// |--|--|
/// |String| the name of the Timer and the Scoreboard |
/// |ticks| the delay in ticks between each execution(required) |
/// |child| a Widget that is executed after the delay |
/// |steps| the number that it counts up every time(default = 1) |
/// |start| a number that is used to reset the timer after the delay(default = 0) |
/// |selector| a custom selector to hold the score (default = playername of name) |
/// |path| a custom path to hold the required function(default = timers/) |
///
/// **Example:**
///
/// ```dart
/// ScoreTimerModule(
/// "timer1",
/// ticks: 200, // 10sec
/// child: Log("Timer triggered"),
/// steps: 1,
/// start: 0,
/// )
/// ```
ScoreTimerModule(
this.name, {
this.child,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage: https://stevertus.com/objD
repository: https://github.com/Stevertus/objD
issue_tracker: https://github.com/Stevertus/objD/issues
documentation: https://stevertus.com/objD/documentation
description: objd is a Object Oriented framework for Building Minecraft Datapacks with ease
description: objd is an Object Oriented framework for Building Minecraft Datapacks with ease
environment:
sdk: ">=2.3.0 <3.0.0"
dependencies:
Expand Down

0 comments on commit 963ac71

Please sign in to comment.