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

Fix: Avoid globals starting with 'i/' #556

Merged
merged 3 commits into from
Apr 8, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ func configure() -> ESCCommandArgumentDescriptor:
)


# Validate whether the given arguments match the command descriptor
func validate(arguments: Array):
if arguments[0].begins_with("i/"):
escoria.logger.report_errors(
"inventory_add: invalid item name",
[
"Item name %s cannot start with 'i/'." % arguments[0]
]
)
return false
return .validate(arguments)


# Run the command
func run(command_params: Array) -> int:
escoria.inventory_manager.add_item(command_params[0])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func set_global(key: String, value, ignore_reserved: bool = false) -> void:
"Global key %s is reserved and can not be overridden" % key
]
)

emit_signal(
"global_changed",
key,
Expand Down