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.

34 lines
682 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()
participant.set_name(__name)
return participant
func set_name(__name:String) -> void:
var invalid = RegEx.new()
invalid.compile("[^a-zA-Z0-9+._-]+")
__name = invalid.sub(__name, '', true)
__name = __name.substr(0, min(__name.length(), 20))
if "" == __name:
printerr("Participant name is empty!")
name = __name
func get_name() -> String:
if null == name:
return 'Anonymous'
return name