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

Add level sequence and advanced level configuration #1292

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
b04f78a
Create data objects for saving a level sequence, with only the basic …
jaythebusinessgoose Jan 5, 2025
d058e16
Create a panel to create and edit a sequence of levels.
jaythebusinessgoose Jan 5, 2025
6fea369
Add Biome <---> Theme conversion methods.
jaythebusinessgoose Jan 5, 2025
70def2e
Use Theme instead of BIOME in custom level editor.
jaythebusinessgoose Jan 5, 2025
79898b4
Update tile sets to use Theme instead of BIOME and add tile sets for …
jaythebusinessgoose Jan 5, 2025
2aeb35e
Run formatter
jaythebusinessgoose Jan 5, 2025
5d262c5
Add a panel to the custom level editor to configure a sequence of lev…
jaythebusinessgoose Jan 5, 2025
e60b5bd
Only save sequence info if one has been created now or in the past.
jaythebusinessgoose Jan 5, 2025
6c5ff07
Remove print statement
jaythebusinessgoose Jan 5, 2025
3e6b459
Save changes to level theme when saving level.
jaythebusinessgoose Jan 5, 2025
3222ed3
Remove more print statements.
jaythebusinessgoose Jan 5, 2025
8eaac33
Move theme selection into new panel tab.
jaythebusinessgoose Jan 5, 2025
bc954ef
Add subtheme configuration.
jaythebusinessgoose Jan 5, 2025
0789c1e
Fix wrong type for theme.
jaythebusinessgoose Jan 5, 2025
5658c95
Add level size to configuration of CO levels.
jaythebusinessgoose Jan 5, 2025
47a9476
Add border configuration to custom levels.
jaythebusinessgoose Jan 7, 2025
b57e97f
Move level size select to the Level Configuration panel.
jaythebusinessgoose Jan 7, 2025
f380023
Fix message above border entity theme box.
jaythebusinessgoose Jan 7, 2025
4d6eabc
Add configuration of background theme.
jaythebusinessgoose Jan 7, 2025
b5c5715
Add loop var.
jaythebusinessgoose Jan 7, 2025
b8a5639
Provide level size all the time, in case any theme property is set to…
jaythebusinessgoose Jan 7, 2025
4afc8ed
Remove crocman and snake from Duat suggested tiles.
jaythebusinessgoose Jan 7, 2025
fce5cf8
Run formatter
jaythebusinessgoose Jan 7, 2025
2dcf8d5
Add customization for floor and music theme.
jaythebusinessgoose Jan 7, 2025
817ea1b
Remove some of the extra space between fields.
jaythebusinessgoose Jan 7, 2025
0c9f353
Ran formatter
jaythebusinessgoose Jan 7, 2025
9a89bd8
Fix wrong level_name list.
jaythebusinessgoose Jan 7, 2025
a80c36c
Add level display name configuration.
jaythebusinessgoose Jan 8, 2025
5618712
Remove unused imports
jaythebusinessgoose Jan 8, 2025
3082027
Fix not clearing background texture theme.
jaythebusinessgoose Jan 8, 2025
585b56b
Add configuration of CO fixes.
jaythebusinessgoose Jan 8, 2025
e4da2de
Add warning above advanced settings if level is not in sequence.
jaythebusinessgoose Jan 9, 2025
4262467
Add button to install LevelSequence library.
jaythebusinessgoose Jan 9, 2025
f971f9b
Add a button to generate a main.lua file in the modpack.
jaythebusinessgoose Jan 9, 2025
dd7c506
Add ending sequence to main template.
jaythebusinessgoose Jan 9, 2025
3d7a089
Add option to add levels to sequence on creation. Default this to tru…
jaythebusinessgoose Jan 9, 2025
6b53683
Ignore keyboard events in tool select when an Entry field is being ed…
jaythebusinessgoose Jan 9, 2025
d198f43
Ignore keyboard events in the palette panel when an Entry field is be…
jaythebusinessgoose Jan 9, 2025
9145afa
Ran formatter.
jaythebusinessgoose Jan 9, 2025
23b38dc
Add toasts on level start to template.
jaythebusinessgoose Jan 9, 2025
cca0c22
Add empty line to end of main template.
jaythebusinessgoose Jan 9, 2025
9db297e
Add a bunch of method comments, and delete some incorrect comments.
jaythebusinessgoose Jan 9, 2025
706b33d
Disable name entry field when panel is not active.
jaythebusinessgoose Jan 9, 2025
c143d68
Fix arena with custom editor changes.
jaythebusinessgoose Jan 10, 2025
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
22 changes: 22 additions & 0 deletions src/modlunky2/static/templates/main.lua.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
meta = {
name = '<ModName>',
version = '0.1',
description = '',
author = '',
}

local level_sequence = require("LevelSequence/level_sequence")

level_sequence.load_levels()
level_sequence.set_show_toast(true)

level_sequence.set_on_win(function(attempts, total_time)
print("You won!")
warp(1, 1, THEME.BASE_CAMP)
end)

set_callback(level_sequence.activate, ON.LOAD)

set_callback(level_sequence.activate, ON.SCRIPT_ENABLE)

set_callback(level_sequence.deactivate, ON.SCRIPT_DISABLE)
29 changes: 27 additions & 2 deletions src/modlunky2/ui/levels/custom_levels/create_level_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@


def present_create_level_dialog(
modlunky_config, backup_dir, lvls_path, current_save_format, on_level_created
modlunky_config,
backup_dir,
lvls_path,
current_save_format,
has_sequence,
can_add_to_sequence,
on_level_created,
):
win = PopupWindow("Create Level", modlunky_config)

Expand Down Expand Up @@ -103,6 +109,25 @@ def present_create_level_dialog(
if create_save_format:
save_format_combobox.set(create_save_format.name)

values_row = values_row + 1

if can_add_to_sequence:
add_to_sequence_var = tk.IntVar()
add_to_sequence_var.set(has_sequence)

add_to_sequence_label = tk.Label(values_frame, text="Add to Sequence: ")
add_to_sequence_label.grid(row=values_row, column=0, sticky="nes", pady=2)

tk.Checkbutton(
values_frame,
text="",
variable=add_to_sequence_var,
onvalue=True,
offvalue=False,
).grid(row=values_row, column=1, sticky="nws", pady=2)

values_row = values_row + 1

warning_label = tk.Label(
win, text="", foreground="red", wraplength=200, justify=tk.LEFT
)
Expand Down Expand Up @@ -207,7 +232,7 @@ def create_level():
background,
)
if saved:
on_level_created(lvl_file_name)
on_level_created(lvl_file_name, add_to_sequence_var.get())
else:
logger.debug("error saving lvl file.")
win.destroy()
Expand Down
Loading