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

Ink 1.1.1 #69

Merged
merged 4 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
destination:
- "3.3.4"
- "3.4.5"
- "3.5"
- "3.5.2"

steps:
- name: "(Shared) Check out the repository"
Expand Down Expand Up @@ -61,29 +61,29 @@ jobs:
run: |
./godot -d -s --path "inkgd" "addons/gut/gut_cmdln.gd"

- name: "(Mono) Install Godot"
env:
VERSION: ${{ matrix.destination }}
run: |
wget -q https://downloads.tuxfamily.org/godotengine/${VERSION}/mono/Godot_v${VERSION}-stable_mono_linux_headless_64.zip
unzip Godot_v${VERSION}-stable_mono_linux_headless_64.zip
mv Godot_v${VERSION}-stable_mono_linux_headless_64 godot_mono
mv godot_mono/Godot_v${VERSION}-stable_mono_linux_headless.64 godot_mono/godot_mono
chmod +x godot_mono/godot_mono
# - name: "(Mono) Install Godot"
# env:
# VERSION: ${{ matrix.destination }}
# run: |
# wget -q https://downloads.tuxfamily.org/godotengine/${VERSION}/mono/Godot_v${VERSION}-stable_mono_linux_headless_64.zip
# unzip Godot_v${VERSION}-stable_mono_linux_headless_64.zip
# mv Godot_v${VERSION}-stable_mono_linux_headless_64 godot_mono
# mv godot_mono/Godot_v${VERSION}-stable_mono_linux_headless.64 godot_mono/godot_mono
# chmod +x godot_mono/godot_mono

- name: "(Mono) Install Ink Runtime"
run: |
wget -q https://github.com/inkle/ink/releases/download/v1.0.0/inklecate_windows.zip
unzip inklecate_windows.zip
mv ink-engine-runtime.dll inkgd/addons/inkgd/mono/assemblies/ink-engine-runtime.dll
# - name: "(Mono) Install Ink Runtime"
# run: |
# wget -q https://github.com/inkle/ink/releases/download/v1.0.0/inklecate_windows.zip
# unzip inklecate_windows.zip
# mv ink-engine-runtime.dll inkgd/addons/inkgd/mono/assemblies/ink-engine-runtime.dll

- name: "(Mono) Compile C# solution"
run: |
./godot_mono/godot_mono --quit --path "inkgd"
cd inkgd
msbuild inkgd.sln /restore /t:Build /p:Configuration=Debug
cd ..
# - name: "(Mono) Compile C# solution"
# run: |
# ./godot_mono/godot_mono --quit --path "inkgd"
# cd inkgd
# msbuild inkgd.sln /restore /t:Build /p:Configuration=Debug
# cd ..

- name: "(Mono) Run tests (Mono)"
run: |
./godot_mono/godot_mono -d -s --path "inkgd" "addons/gut/gut_cmdln.gd"
# - name: "(Mono) Run tests (Mono)"
# run: |
# ./godot_mono/godot_mono -d -s --path "inkgd" "addons/gut/gut_cmdln.gd"
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# Change Log
Important changes to _inkgd_ will be documented in this file.

## [0.4.7](https://github.com/ephread/inkgd/releases/tag/0.4.X)
## [0.5.0](https://github.com/ephread/inkgd/releases/tag/0.5.0)
Released on 2023-01-XX.

### Changed
- Added support for inklecate 1.1.1.
- Exposed new properties on InkPlayer (`alive_flow_names` & `current_flow_is_default_flow`).

#### ⚠️ BREAKING CHANGE**
- [`InkPlayer`] The `prompt_choices` and `choice_made` signals as well as the `current_choices`
property now use instances of `InkChoice` instead of strings. Use the `text` property of `InkChoice`
to access the text representation.

## [0.4.7](https://github.com/ephread/inkgd/releases/tag/0.4.7)
Released on 2022-08-07.

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion addons/inkgd/editor/panel/preview/ink_preview_panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func _continue_story():
var i = 0
for choice in _ink_player.current_choices:
var button = Button.new()
button.text = choice
button.text = choice.text
button.connect("pressed", self, "_choice_button_pressed", [i])

_choices_container.add_child(button)
Expand Down
3 changes: 2 additions & 1 deletion addons/inkgd/editor/templates/ink_template.gd
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ func _continue_story():
%TS%if _ink_player.has_choices:
%TS%%TS%# 'current_choices' contains a list of the choices, as strings.
%TS%%TS%for choice in _ink_player.current_choices:
%TS%%TS%%TS%print(choice)
%TS%%TS%%TS%print(choice.text)
%TS%%TS%%TS%print(choice.tags)
%TS%%TS%# '_select_choice' is a function that will take the index of
%TS%%TS%# your selection and continue the story.
%TS%%TS%_select_choice(0)
Expand Down
26 changes: 21 additions & 5 deletions addons/inkgd/ink_player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,7 @@ func get_current_choices() -> Array:
_push_null_story_error()
return []

var text_choices = []
for choice in _story.current_choices:
text_choices.append(choice.text)

return text_choices
return _story.current_choices.duplicate()


## The current tags. Empty is there are no tags for the current line.
Expand Down Expand Up @@ -256,6 +252,26 @@ func get_current_flow_name() -> String:
return _story.state.current_flow_name


## The names of all flows currently alive.
var alive_flow_names: Array setget , get_alive_flow_names
func get_alive_flow_names() -> Array:
if _story == null:
_push_null_story_error()
return []

return _story.alive_flow_names


## `true` if the current flow is the default flow.
var current_flow_is_default_flow: bool setget , get_current_flow_is_default_flow
func get_current_flow_is_default_flow() -> bool:
if _story == null:
_push_null_story_error()
return false

return _story.current_flow_is_default_flow


## The current story path.
var current_path: String setget , get_current_path
func get_current_path() -> String:
Expand Down
10 changes: 4 additions & 6 deletions addons/inkgd/mono/InkPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class InkPlayer : Node
[Signal] public delegate void loaded(bool successfully);
[Signal] public delegate void continued(string text, Godot.Collections.Array<string> tags);
[Signal] public delegate void interrupted();
[Signal] public delegate void prompt_choices(Godot.Collections.Array<string> choices);
[Signal] public delegate void choice_made(string choice);
[Signal] public delegate void prompt_choices(Godot.Collections.Array<Godot.Object> choices);
[Signal] public delegate void choice_made(Godot.Object choice);
[Signal] public delegate void function_evaluating(Godot.Collections.Array<string> function_name, object[] arguments);
[Signal] public delegate void function_evaluated(Godot.Collections.Array<string> function_name, object[] arguments, Godot.Object function_result);
[Signal] public delegate void path_choosen(string path, object[] arguments);
Expand Down Expand Up @@ -140,10 +140,8 @@ public Godot.Collections.Array<string> current_choices
return new Godot.Collections.Array<string>();
}

var choices = story.currentChoices?.ConvertAll(choice => choice.text).ToArray();

if (choices != null) {
return new Godot.Collections.Array<string>(choices);
return new Godot.Collections.Array<string>(story.currentChoices);
} else {
return new Godot.Collections.Array<string>();
}
Expand Down Expand Up @@ -1045,7 +1043,7 @@ private void onDidContinue()

private void onMakeChoice(Ink.Runtime.Choice choice)
{
EmitSignal("choice_made", new object[] { choice.text });
EmitSignal("choice_made", new object[] { choice });
}

private void onEvaluateFunction(string functionName, object[] arguments)
Expand Down
3 changes: 3 additions & 0 deletions addons/inkgd/runtime/content/choices/choice.gd
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ var original_thread_index: int = 0

var is_invisible_default: bool = false

# Array<String>?
var tags

# ############################################################################ #
# GDScript extra methods
# ############################################################################ #
Expand Down
10 changes: 10 additions & 0 deletions addons/inkgd/runtime/content/control_command.gd
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ enum CommandType {
LIST_FROM_INT,
LIST_RANGE,
LIST_RANDOM,
BEGIN_TAG,
END_TAG
#----
TOTAL_VALUES
}
Expand Down Expand Up @@ -135,6 +137,12 @@ static func list_range() -> InkControlCommand:
static func list_random() -> InkControlCommand:
return ControlCommand().new(CommandType.LIST_RANDOM)

static func begin_tag() -> InkControlCommand:
return ControlCommand().new(CommandType.BEGIN_TAG)

static func end_tag() -> InkControlCommand:
return ControlCommand().new(CommandType.END_TAG)

# () -> String
func _to_string() -> String:
var command_name: String = ""
Expand Down Expand Up @@ -164,6 +172,8 @@ func _to_string() -> String:
CommandType.LIST_FROM_INT: command_name = "LIST_FROM_INT"
CommandType.LIST_RANGE: command_name = "LIST_RANGE"
CommandType.LIST_RANDOM: command_name = "LIST_RANDOM"
CommandType.BEGIN_TAG: command_name = "BEGIN_TAG"
CommandType.END_TAG: command_name = "END_TAG"
CommandType.TOTAL_VALUES: command_name = "TOTAL_VALUES"

return "Command(%s)" % command_name
Expand Down
Loading