Fix: Avoid globals starting with 'i/' (#556)
This commit is contained in:
@@ -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
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
escoria.inventory_manager.add_item(command_params[0])
|
escoria.inventory_manager.add_item(command_params[0])
|
||||||
|
|||||||
@@ -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
|
"Global key %s is reserved and can not be overridden" % key
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
emit_signal(
|
emit_signal(
|
||||||
"global_changed",
|
"global_changed",
|
||||||
key,
|
key,
|
||||||
|
|||||||
Reference in New Issue
Block a user