A Godot Engine app to help streamers organize Majority Judgment polls in their streams.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
847 B

extends Resource
class_name MajorityJudgmentParticipant
Citizens of the world, unite!
export(String) var name:String setget set_name, get_name
static func make(__name):
var participant = load("res://addons/majority_judgment/MajorityJudgmentParticipant.gd").new()
return participant
func set_name(__name:String) -> void:
__name = sanitize_name(__name)
if "" == __name:
printerr("Participant name is empty!")
name = __name
static func sanitize_name(__name:String) -> String:
var invalid = RegEx.new()
# Allow unicode letters and numbers only, with . and _ and -
__name = invalid.sub(__name, '', true)
__name = __name.substr(0, min(__name.length(), 20))
return __name
func get_name() -> String:
if null == name:
return 'Anonymous'
return name