Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typewriter v0.7 | Dynamic Variables #283

Merged
merged 115 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
7e4d917
Achieve resoved thread from 3 days to 1
gabber235 Nov 9, 2024
2ba853d
[Git] Change .gitattributes
Marten-Mrfc Nov 10, 2024
5a2ac44
Additionall suggestion
gabber235 Nov 10, 2024
d0132ad
Lower long press delay for Entry drag & drop
gabber235 Nov 10, 2024
2d134b6
Create Duplicate Entry action
gabber235 Nov 10, 2024
4f83fd5
Create dynamic variables
gabber235 Nov 8, 2024
05e878e
Make Entries allow for Variables
gabber235 Nov 10, 2024
fc72c04
Fix complex blueprint serialization
gabber235 Nov 10, 2024
3173f26
Write variable documentation
gabber235 Nov 10, 2024
ed0e533
Make auto resolving take 2 days instead of 1
gabber235 Nov 12, 2024
d3595d8
Disable ping to support when completing manually
gabber235 Nov 12, 2024
76b6b30
Improve entry deprecation notice
gabber235 Nov 12, 2024
d7738ae
Allow headers to inherit actions from a child
gabber235 Nov 12, 2024
d28221c
Implemented skin variable
gabber235 Nov 12, 2024
801cf69
Add Ranged Variable
gabber235 Nov 13, 2024
6f74fe0
Deploying to develop from @ gabber235/TypeWriter@d7e69e8e88801b72026d…
gabber235 Nov 13, 2024
c0e3e14
Fix coordinate with null
gabber235 Nov 15, 2024
2d09515
Rename location to position
gabber235 Nov 15, 2024
b137aa5
Limit intake to 1 message of winston
gabber235 Nov 18, 2024
bbe1515
Make lines concurrent safe
gabber235 Nov 18, 2024
810599c
[Docs] Fixed dev building not working
Marten-Mrfc Nov 18, 2024
8751754
[Docs] PacketEvents troubleshooting added
Marten-Mrfc Nov 18, 2024
9067ba8
Bump cross-spawn from 7.0.3 to 7.0.6 in /documentation
dependabot[bot] Nov 18, 2024
1e18349
[Docs] Added shortcuts
Marten-Mrfc Nov 18, 2024
bacdf34
[Docs] Typo fix
Marten-Mrfc Nov 18, 2024
2f873b7
[Docs] Add warning entity extension
Marten-Mrfc Nov 18, 2024
d4ecdfe
[Docs] Added conditional npc showing page
Marten-Mrfc Nov 18, 2024
146f2fd
[Docs] Quick bug fix
Marten-Mrfc Nov 18, 2024
56a0655
[docs] Quick fix #2
Marten-Mrfc Nov 18, 2024
255af57
Remove Winston Intake
gabber235 Nov 19, 2024
ebebc1c
Remove limit on search
gabber235 Nov 19, 2024
d851166
Make Eye Height shift fixed
gabber235 Nov 19, 2024
46dce32
Catch Packet Events errors to not block dialogue
gabber235 Nov 20, 2024
33db71b
Drop items if inventory is full
gabber235 Nov 20, 2024
5ed78f5
Make sure that subtypes also have default values for primary constructor
gabber235 Nov 20, 2024
001c1a3
Prevent invalid commands from blocking Typewriter startup
gabber235 Nov 20, 2024
d47da3f
[Bot] Test bot commit
Marten-Mrfc Nov 20, 2024
90ab98c
[Bot] rename command
Marten-Mrfc Nov 20, 2024
1d17de3
Allow to change the named entity background color
gabber235 Nov 20, 2024
2c2e38f
Add inspect and query command for facts
gabber235 Nov 21, 2024
758123d
Allow entry placeholders to have parameters
gabber235 Nov 21, 2024
950ccbb
added ArmorStandEntity, EnderDragonEntity, ParrotEntity, WolfEntity a…
Kerzinator24 Nov 22, 2024
ac898ee
Fix issues
gabber235 Nov 24, 2024
393cdff
Add additional docs
gabber235 Nov 24, 2024
747bb70
[Docs] Update + change to 0.6.1
Marten-Mrfc Nov 24, 2024
0736d0f
[Blog] Added new blog posts
Marten-Mrfc Nov 24, 2024
c418dc0
Fix physical interaction not triggering
gabber235 Nov 24, 2024
69724f6
Create LookingDirectionVariable
gabber235 Nov 24, 2024
1be0f30
Fix checkboxes for boolean not updating
gabber235 Nov 24, 2024
8ebeec1
[Docs] Bug fix
Marten-Mrfc Nov 24, 2024
b5c9a04
Add sudo option to the player command entry
gabber235 Nov 24, 2024
831acf7
Create CalculatedFact with evaluated expression and placeholders
gabber235 Nov 24, 2024
9836685
Add %typewriter_<entry id>:remaining:<number>% parameter
gabber235 Nov 24, 2024
2db35e5
Create block display entity
gabber235 Nov 24, 2024
c6af7fb
Count item in cursor
gabber235 Nov 24, 2024
e543dbc
Create WorldAudience Entry
gabber235 Nov 24, 2024
f07c18f
Create WeightedRandomTriggerGate
gabber235 Nov 24, 2024
d89bfd0
Create BulkFactsResetActionEntry
gabber235 Nov 24, 2024
4bb21e2
Create PotionEffectAudience
gabber235 Nov 24, 2024
b71b91b
Create FactValueVariable
gabber235 Nov 24, 2024
43147ab
Add no elements to map editor
gabber235 Nov 24, 2024
45d48c7
Bump module plugin version
gabber235 Nov 24, 2024
7d4142c
When clicking on a block to create a node, creates the node at the block
gabber235 Nov 26, 2024
7bb02f4
Made Pathstream list concurrent
gabber235 Nov 28, 2024
c363637
Allow for click on air
gabber235 Nov 28, 2024
7ae7cae
Prevent desync between recording and playback
gabber235 Nov 28, 2024
3099939
When no child is not parsable, just return null
gabber235 Nov 28, 2024
c4b9752
Make the default value also the default when no value is present
gabber235 Nov 28, 2024
d55407b
Deploying to develop from @ gabber235/TypeWriter@cd598c03011183803498…
gabber235 Nov 29, 2024
a073355
Fix with rotation for positions
gabber235 Nov 30, 2024
c8a07f9
Rewrite Header calculation
gabber235 Dec 4, 2024
d2ffb68
Fix block place with location
gabber235 Dec 4, 2024
9ac8d36
Revert Looking Direction Variable to use a vector scalar
gabber235 Dec 4, 2024
b594dce
Allow rotation for PlayerWorldPositionVariable
gabber235 Dec 4, 2024
05e4d7a
Implement World Editor
gabber235 Dec 4, 2024
b3bbf57
Allow InteractionIndicatorDefinition to spawn child definition
gabber235 Dec 4, 2024
0c39627
Fix Stacked Entity to not ride itself
gabber235 Dec 4, 2024
d245bae
Fix Map with Ref key being usable
gabber235 Dec 4, 2024
abf6673
Show Map Ref keys as triggers and delete from map when entry gets del…
gabber235 Dec 4, 2024
651d575
Prevent errors when sound has no files
gabber235 Dec 4, 2024
1b560df
Fix Placeholder Typo
gabber235 Dec 4, 2024
f0018d0
Fix empty (de)serialization for SerializedItem
gabber235 Dec 4, 2024
49388af
Partially send messages when it is not needed to resend full history
gabber235 Dec 4, 2024
7003c5d
Teleport player async and load in chuncks before
gabber235 Dec 4, 2024
8074b8d
Add Rotation data for display entities
gabber235 Dec 4, 2024
1fefb7c
Update entitylib
gabber235 Dec 4, 2024
24bc43e
Fix bedrock dialogue speaker name
gabber235 Dec 4, 2024
def8d22
Have the interaction indicator definition show the indicator for itself.
gabber235 Dec 4, 2024
70de1eb
Deploying to develop from @ gabber235/TypeWriter@ae5e5bccb29d3f4bcf01…
gabber235 Dec 5, 2024
f8b1fe2
Deploying to develop from @ gabber235/TypeWriter@8134688c27a6bbdcc381…
gabber235 Dec 6, 2024
dd6603d
Add default values
gabber235 Dec 11, 2024
457b4cb
Make sure the help is shown regardless of type
gabber235 Dec 11, 2024
686cf2b
Deploying to develop from @ gabber235/TypeWriter@69849d8665122b70771c…
gabber235 Dec 11, 2024
d82484e
Use generated entity identifiers
gabber235 Dec 11, 2024
e3039d9
Disable Message Dialogue from resending chat
gabber235 Dec 11, 2024
e6c2eb9
Resend history before start dialogue
gabber235 Dec 13, 2024
c49183b
Reset blocking state after resend
gabber235 Dec 13, 2024
30d8a86
Fix flutter linting updates
gabber235 Dec 13, 2024
2406ee3
[Docs] Update adapter.json (OLD SYSTEM!)
Marten-Mrfc Dec 14, 2024
a746c46
[Docs] Added ActionButton component
Marten-Mrfc Dec 14, 2024
39c3090
[Docs] Small fixes
Marten-Mrfc Dec 14, 2024
b3fd1ef
[Docs] Added first dynamic variable documentation
Marten-Mrfc Dec 14, 2024
a03f638
Deploying to develop from @ gabber235/TypeWriter@43b997fe076191f2af12…
gabber235 Dec 14, 2024
27a2c68
[Docs] Updated PlaceHolderAPI docs
Marten-Mrfc Dec 14, 2024
02a46fa
[Docs] Grammar changes
Marten-Mrfc Dec 14, 2024
87cfff5
[Docs] Added questField
Marten-Mrfc Dec 14, 2024
de60052
[Docs] Added a full quest tutorial
Marten-Mrfc Dec 14, 2024
04165dc
Remove full quest
gabber235 Dec 15, 2024
1aa4a34
[Docs] Converter changes
Marten-Mrfc Dec 15, 2024
d0746af
[Docs] Video updates
Marten-Mrfc Dec 15, 2024
7b57f8f
[Docs] Update docs
Marten-Mrfc Dec 15, 2024
5aab066
[Docs] Add V0.7.0
Marten-Mrfc Dec 15, 2024
e9c3c0f
Add fixed snippets to v0.7 version
gabber235 Dec 15, 2024
2ff50e6
Bump path-to-regexp and express in /documentation
dependabot[bot] Dec 15, 2024
d5657fc
Bump nanoid from 3.3.7 to 3.3.8 in /documentation
dependabot[bot] Dec 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Auto detect text files and perform LF normalization
* text=auto
/extensions/_DocsExtension/**/*.kt text eol=lf
* text=auto
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For detailed setup instructions, visit the [Installation Guide](https://docs.typ

### Sponsors

<!-- sponsors --><!-- sponsors -->
<!-- sponsors --><a href="https://github.com/myiume"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;3586926?u&#x3D;3db6af564b6ef85fa06122661bd686188c016e56&amp;v&#x3D;4" width="60px" alt="Myiume" /></a><a href="https://github.com/blue-dev00"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;174703443?v&#x3D;4" width="60px" alt="" /></a><a href="https://github.com/JesusRuescas"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;12575781?u&#x3D;739fc50505f7ad93508f95161948606f61c8f516&amp;v&#x3D;4" width="60px" alt="Jesus Ruescas Junior" /></a><a href="https://github.com/AllayRPG"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;132414911?u&#x3D;8c58ae3c38e719740962b39c7694c1dc8435d962&amp;v&#x3D;4" width="60px" alt="Farkaaas" /></a><!-- sponsors -->

Thanks to the following sponsors for supporting this project. Without their support, this project would not be possible. If you are using Typewriter for your server, and are making money from it, please consider [sponsoring](https://github.com/sponsors/gabber235) the project.

Expand Down
23 changes: 23 additions & 0 deletions app/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
targets:
$default:
builders:
json_serializable:
options:
# Options configure how source code is generated for every
# `@JsonSerializable`-annotated class in the package.
#
# The default value for each is listed.
any_map: false
checked: false
constructor: ""
create_factory: true
create_field_map: false
create_json_keys: false
create_per_field_to_json: false
create_to_json: true
disallow_unrecognized_keys: false
explicit_to_json: true
field_rename: none
generic_argument_factories: false
ignore_unannotated: false
include_if_null: true
3 changes: 2 additions & 1 deletion app/lib/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "dart:async";

import "package:auto_route/auto_route.dart";
import "package:flutter/material.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:riverpod_annotation/riverpod_annotation.dart";
import "package:typewriter/guard/connected_guard.dart";
import "package:typewriter/models/page.dart";
Expand Down Expand Up @@ -85,7 +86,7 @@ class InvalidatorNavigatorObserver extends NavigatorObserver {

/// Provides the current route data for the given [name].
@Riverpod(keepAlive: true)
RouteData? currentRouteData(CurrentRouteDataRef ref, String path) {
RouteData? currentRouteData(Ref ref, String path) {
final router = ref.watch(appRouter);
return _fetchCurrentRouteData(path, router);
}
Expand Down
6 changes: 4 additions & 2 deletions app/lib/app_router.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion app/lib/hooks/delayed_execution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class _DelayedExecutionHook extends Hook<void> {
_DelayedExecutionHookState createState() => _DelayedExecutionHookState();
}

class _DelayedExecutionHookState extends HookState<void, _DelayedExecutionHook> {
class _DelayedExecutionHookState
extends HookState<void, _DelayedExecutionHook> {
void _run() {
WidgetsBinding.instance.addPostFrameCallback((_) => hook.function());
}
Expand Down
110 changes: 110 additions & 0 deletions app/lib/hooks/staggered_animation_controllers.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import "dart:async";

import "package:flutter/material.dart";
import "package:flutter_hooks/flutter_hooks.dart";

/// Run multiple animation staggered from each other.
List<AnimationController> useStaggeredAnimationControllers({
required int count,
required Duration duration,
required Duration interval,
required TickerProvider vsync,
bool autoPlay = true,
}) {
return use(
_StaggeredAnimationControllersHook(
count,
duration,
interval,
vsync,
autoPlay: autoPlay,
),
);
}

class _StaggeredAnimationControllersHook
extends Hook<List<AnimationController>> {
const _StaggeredAnimationControllersHook(
this.count,
this.duration,
this.interval,
this.vsync, {
required this.autoPlay,
});

final int count;
final Duration duration;
final Duration interval;
final bool autoPlay;
final TickerProvider vsync;

@override
_StaggeredAnimationControllersHookState createState() =>
_StaggeredAnimationControllersHookState();
}

class _StaggeredAnimationControllersHookState extends HookState<
List<AnimationController>, _StaggeredAnimationControllersHook> {
List<AnimationController> controllers = [];
Timer? timer;
int index = 0;

void _animate() {
if (!hook.autoPlay) {
return;
}
if (timer != null) {
return;
}
if (index >= hook.count) {
return;
}
timer = Timer.periodic(hook.interval, (timer) {
controllers[index].forward();
index = index + 1;
if (index >= hook.count) {
timer.cancel();
this.timer = null;
}
});
}

void _updateControllers() {
while (controllers.length > hook.count) {
controllers.removeLast();
}

while (controllers.length < hook.count) {
controllers.add(
AnimationController(
duration: hook.duration,
vsync: hook.vsync,
),
);

if (index >= controllers.length) {
index = controllers.length - 1;
}
}
}

@override
void initHook() {
_updateControllers();
_animate();
super.initHook();
}

@override
List<AnimationController> build(BuildContext context) {
_updateControllers();
_animate();
return controllers;
}

@override
void dispose() {
timer?.cancel();
super.dispose();
}
}
6 changes: 3 additions & 3 deletions app/lib/models/communicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final socketProvider = StateNotifierProvider<SocketNotifier, Socket?>(
class SocketNotifier extends StateNotifier<Socket?> {
SocketNotifier(this.ref) : super(null);

final StateNotifierProviderRef<SocketNotifier, Socket?> ref;
final Ref ref;
bool _disposed = false;

/// When a socket gets disconnected, we want to try to reconnect it.
Expand Down Expand Up @@ -235,13 +235,13 @@ class SocketNotifier extends StateNotifier<Socket?> {
}

@Riverpod(keepAlive: true)
Communicator communicator(CommunicatorRef ref) => Communicator(ref);
Communicator communicator(Ref ref) => Communicator(ref);

@immutable
class Communicator {
const Communicator(this.ref);

final CommunicatorRef ref;
final Ref ref;

Future<void> fetchBook() async {
final socket = ref.read(socketProvider);
Expand Down
6 changes: 4 additions & 2 deletions app/lib/models/communicator.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 45 additions & 7 deletions app/lib/models/entry.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "dart:convert";

import "package:collection/collection.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:riverpod_annotation/riverpod_annotation.dart";
import "package:typewriter/models/entry_blueprint.dart";
import "package:typewriter/models/page.dart";
Expand All @@ -11,7 +12,7 @@ part "entry.g.dart";

@riverpod
EntryDefinition? entryDefinition(
EntryDefinitionRef ref,
Ref ref,
String entryId,
) {
final page = ref.watch(entryPageProvider(entryId));
Expand All @@ -32,21 +33,30 @@ EntryDefinition? entryDefinition(
}

@riverpod
String? entryName(EntryNameRef ref, String entryId) {
String? entryName(Ref ref, String entryId) {
final entry = ref.watch(globalEntryProvider(entryId));
return entry?.formattedName;
}

@riverpod
String? entryBlueprintId(EntryBlueprintIdRef ref, String entryId) {
String? entryBlueprintId(Ref ref, String entryId) {
final entry = ref.watch(globalEntryProvider(entryId));
return entry?.blueprintId;
}

@riverpod
bool isEntryDeprecated(IsEntryDeprecatedRef ref, String entryId) {
final entryTags = ref.watch(entryTagsProvider(entryId));
return entryTags.contains("deprecated");
DeprecatedModifier? entryDeprecated(Ref ref, String entryId) {
final blueprintId = ref.watch(entryBlueprintIdProvider(entryId));
if (blueprintId == null) return null;
final blueprint = ref.watch(entryBlueprintProvider(blueprintId));
if (blueprint == null) return null;
return blueprint.modifiers.whereType<DeprecatedModifier>().firstOrNull;
}

@riverpod
bool isEntryDeprecated(Ref ref, String entryId) {
final deprecated = ref.watch(entryDeprecatedProvider(entryId));
return deprecated != null;
}

class EntryDefinition {
Expand Down Expand Up @@ -74,15 +84,28 @@ class Entry {
Entry.fromBlueprint({
required String id,
required EntryBlueprint blueprint,
}) : data = {
DataBlueprint? genericBlueprint,
}) : assert(
blueprint.isGeneric == (genericBlueprint != null),
blueprint.isGeneric
? "Blueprint is generic but no generic blueprint was provided"
: "Blueprint is not generic but a generic blueprint was provided",
),
assert(
blueprint.allowsGeneric(genericBlueprint),
"Generic blueprint given is not allowed for this blueprint, blueprint: ${blueprint.id}, allowed: ${blueprint.genericConstraints}, genericBlueprint: $genericBlueprint",
),
data = {
...blueprint.dataBlueprint.defaultValue(),
"id": id,
"name": "new_${blueprint.name}",
"type": blueprint.id,
"_genericBlueprint": genericBlueprint?.toJson(),
};

factory Entry.fromJson(Map<String, dynamic> json) => Entry(json);
final Map<String, dynamic> data;
DataBlueprint? _genericBlueprint;

Map<String, dynamic> toJson() => data;

Expand All @@ -102,6 +125,21 @@ class Entry {
throw Exception("Could not find blueprint id or type in entry data");
}

/// Returns the generic blueprint of the entry.
DataBlueprint? get genericBlueprint {
if (_genericBlueprint != null) return _genericBlueprint;
final genericBlueprint = data["_genericBlueprint"];
if (genericBlueprint == null) return null;

if (genericBlueprint is! Map<String, dynamic>) {
throw Exception("Generic blueprint is not a map");
}

final blueprint = DataBlueprint.fromJson(genericBlueprint);
_genericBlueprint = blueprint;
return blueprint;
}

/// Returns the values in [map] that match [path].
///
/// The path is a string representation of keys and indices to access the values in [map].
Expand Down
Loading
Loading