replaced arg passed to command functions with CommandInfo
This commit is contained in:
parent
70f363bfe7
commit
b34ae1b5ee
12
Gift.gd
12
Gift.gd
@ -44,21 +44,21 @@ func _ready() -> void:
|
||||
whisper("TEST", "mennomax")
|
||||
|
||||
# The cmd_data array contains [<sender_data (Array)>, <command_string (String)>, <whisper (bool)>
|
||||
func command_test(cmd_data):
|
||||
func command_test(cmd_info : CommandInfo) -> void:
|
||||
print("A")
|
||||
|
||||
# The cmd_data array contains [<sender_data (Array)>, <command_string (String)>, <whisper (bool)>
|
||||
func hello_world(cmd_data):
|
||||
func hello_world(cmd_info : CommandInfo) -> void:
|
||||
chat("HELLO WORLD!")
|
||||
|
||||
func streamer_only(cmd_data):
|
||||
func streamer_only(cmd_info : CommandInfo) -> void:
|
||||
chat("Streamer command executed")
|
||||
|
||||
func no_permission(cmd_data):
|
||||
func no_permission(cmd_info : CommandInfo) -> void:
|
||||
chat("NO PERMISSION!")
|
||||
|
||||
func greet(cmd_data, arg_ary):
|
||||
func greet(cmd_info : CommandInfo, arg_ary : PoolStringArray) -> void:
|
||||
chat("Greetings, " + arg_ary[0])
|
||||
|
||||
func list(cmd_data, arg_ary):
|
||||
func list(cmd_info : CommandInfo, arg_ary : PoolStringArray) -> void:
|
||||
chat(arg_ary.join(", "))
|
@ -193,9 +193,9 @@ func handle_command(sender_data : SenderData, msg : PoolStringArray, whisper : b
|
||||
print_debug("No Permission for command!")
|
||||
return
|
||||
if(arg_ary.size() == 0):
|
||||
cmd_data.func_ref.call_func([sender_data, command, whisper])
|
||||
cmd_data.func_ref.call_func(CommandInfo.new(sender_data, command, whisper))
|
||||
else:
|
||||
cmd_data.func_ref.call_func([sender_data, command, whisper], arg_ary)
|
||||
cmd_data.func_ref.call_func(CommandInfo.new(sender_data, command, whisper), arg_ary)
|
||||
|
||||
func get_perm_flag_from_tags(tags : Dictionary) -> int:
|
||||
var flag = 0
|
||||
|
12
addons/gift/util/cmd_info.gd
Normal file
12
addons/gift/util/cmd_info.gd
Normal file
@ -0,0 +1,12 @@
|
||||
extends Reference
|
||||
class_name CommandInfo
|
||||
|
||||
var sender_data : SenderData
|
||||
var command : String
|
||||
var whisper : bool
|
||||
|
||||
func _init(sndr_dt, cmd, whspr):
|
||||
sender_data = sndr_dt
|
||||
command = cmd
|
||||
whisper = whspr
|
||||
|
24
export_presets.cfg
Normal file
24
export_presets.cfg
Normal file
@ -0,0 +1,24 @@
|
||||
[preset.0]
|
||||
|
||||
name="Linux/X11"
|
||||
platform="Linux/X11"
|
||||
runnable=true
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="/home/mennomax/Documents/godot/GIFT.x86_64"
|
||||
patch_list=PoolStringArray( )
|
||||
script_export_mode=1
|
||||
script_encryption_key=""
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
texture_format/bptc=false
|
||||
texture_format/s3tc=true
|
||||
texture_format/etc=false
|
||||
texture_format/etc2=false
|
||||
texture_format/no_bptc_fallbacks=true
|
||||
binary_format/64_bits=true
|
||||
custom_template/release=""
|
||||
custom_template/debug=""
|
@ -14,6 +14,11 @@ _global_script_classes=[ {
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/gift/util/cmd_data.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "CommandInfo",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/gift/util/cmd_info.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Gift",
|
||||
"language": "GDScript",
|
||||
@ -26,6 +31,7 @@ _global_script_classes=[ {
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"CommandData": "",
|
||||
"CommandInfo": "",
|
||||
"Gift": "",
|
||||
"SenderData": ""
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user