mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
@@ -223,18 +223,32 @@ var/world_topic_spam_protect_time = world.timeofday
|
|||||||
|
|
||||||
return "Bad Key"
|
return "Bad Key"
|
||||||
|
|
||||||
var/search = input["info"]
|
var/list/search = params2list(input["info"])
|
||||||
var/ckey = ckey(search)
|
var/list/ckeysearch = list()
|
||||||
|
for(var/text in search)
|
||||||
|
ckeysearch += ckey(text)
|
||||||
|
|
||||||
var/list/match = list()
|
var/list/match = list()
|
||||||
|
|
||||||
for(var/mob/M in mob_list)
|
for(var/mob/M in mob_list)
|
||||||
if(findtext(M.name, search))
|
var/strings = list(M.name, M.ckey)
|
||||||
match += M
|
if(M.mind)
|
||||||
else if(M.ckey == ckey)
|
strings += M.mind.assigned_role
|
||||||
match += M
|
strings += M.mind.special_role
|
||||||
else if(M.mind && findtext(M.mind.assigned_role, search))
|
for(var/text in strings)
|
||||||
match += M
|
if(ckey(text) in ckeysearch)
|
||||||
|
match[M] += 10 // an exact match is far better than a partial one
|
||||||
|
else
|
||||||
|
for(var/searchstr in search)
|
||||||
|
if(findtext(text, searchstr))
|
||||||
|
match[M] += 1
|
||||||
|
|
||||||
|
var/maxstrength = 0
|
||||||
|
for(var/mob/M in match)
|
||||||
|
maxstrength = max(match[M], maxstrength)
|
||||||
|
for(var/mob/M in match)
|
||||||
|
if(match[M] < maxstrength)
|
||||||
|
match -= M
|
||||||
|
|
||||||
if(!match.len)
|
if(!match.len)
|
||||||
return "No matches"
|
return "No matches"
|
||||||
|
|||||||
Reference in New Issue
Block a user