mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Merge branch 'incremental_tg' r5200 into bs12_with_tgport
Conflicts: baystation12.dme code/__HELPERS/global_lists.dm code/__HELPERS/type2type.dm code/__HELPERS/unsorted.dm code/datums/datumvars.dm code/datums/disease.dm code/datums/organs/organ_external.dm code/datums/supplypacks.dm code/defines/obj.dm code/game/area/areas.dm code/game/atoms.dm code/game/gamemodes/cult/cult_structures.dm code/game/gamemodes/cult/runes.dm code/game/gamemodes/events.dm code/game/gamemodes/events/ninja_equipment.dm code/game/gamemodes/events/space_ninja.dm code/game/gamemodes/game_mode.dm code/game/gamemodes/gameticker.dm code/game/hud.dm code/game/jobs/access.dm code/game/jobs/job/civilian.dm code/game/machinery/alarm.dm code/game/machinery/cloning.dm code/game/machinery/computer/cloning.dm code/game/machinery/computer/medical.dm code/game/machinery/computer/syndicate_shuttle.dm code/game/machinery/telecomms/broadcaster.dm code/game/machinery/telecomms/machine_interactions.dm code/game/objects/effects/decals/contraband.dm code/game/objects/effects/signs.dm code/game/objects/items/devices/PDA/PDA.dm code/game/objects/items/devices/PDA/cart.dm code/game/objects/items/weapons/photography.dm code/game/objects/structures/door_assembly.dm code/game/objects/structures/window.dm code/game/sound.dm code/game/verbs/ooc.dm code/global.dm code/modules/DetectiveWork/detective_work.dm code/modules/DetectiveWork/evidence.dm code/modules/DetectiveWork/footprints_and_rag.dm code/modules/DetectiveWork/scanner.dm code/modules/admin/player_panel.dm code/modules/admin/verbs/adminhelp.dm code/modules/admin/verbs/adminpm.dm code/modules/awaymissions/gateway.dm code/modules/client/client defines.dm code/modules/client/client procs.dm code/modules/client/preferences.dm code/modules/clothing/spacesuits/rig.dm code/modules/mining/machine_processing.dm code/modules/mining/machine_stacking.dm code/modules/mining/mint.dm code/modules/mining/ores_coins.dm code/modules/mining/satchel_ore_boxdm.dm code/modules/mob/living/carbon/alien/alien.dm code/modules/mob/living/carbon/carbon.dm code/modules/mob/living/carbon/carbon_defines.dm code/modules/mob/living/carbon/human/human_damage.dm code/modules/mob/living/carbon/human/life.dm code/modules/mob/living/carbon/human/update_icons.dm code/modules/mob/living/living.dm code/modules/mob/living/say.dm code/modules/mob/mob.dm code/modules/mob/mob_cleanup.dm code/modules/mob/mob_defines.dm code/modules/mob/mob_transformation_simple.dm code/modules/mob/new_player/login.dm code/modules/mob/new_player/new_player.dm code/modules/mob/new_player/preferences_setup.dm code/modules/mob/new_player/savefile.dm code/modules/mob/new_player/sprite_accessories.dm code/modules/paperwork/folders.dm code/modules/paperwork/paper.dm code/modules/paperwork/photocopier.dm code/modules/projectiles/guns/energy/special.dm code/modules/projectiles/guns/projectile/automatic.dm code/setup.dm code/unused/mining/datum_processing_recipe.dm code/unused/powerarmor/powerarmor.dm code/world.dm html/changelog.html icons/effects/96x96.dmi icons/mob/head.dmi icons/mob/items_lefthand.dmi icons/mob/items_righthand.dmi icons/mob/suit.dmi icons/obj/clothing/hats.dmi icons/obj/clothing/suits.dmi icons/obj/hydroponics.dmi icons/obj/items.dmi icons/turf/areas.dmi icons/turf/walls.dmi maps/RandomZLevels/fileList.txt maps/RandomZLevels/spacebattle.dmm Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
@@ -1,123 +1,103 @@
|
||||
|
||||
|
||||
//This is a list of words which are ignored by the parser when comparing message contents for names. MUST BE IN LOWER CASE!
|
||||
var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "alien", "as")
|
||||
var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","alien","as")
|
||||
|
||||
/client/verb/adminhelp(msg as text)
|
||||
set category = "Admin"
|
||||
set name = "Adminhelp"
|
||||
|
||||
if(muted & MUTE_ADMINHELP)
|
||||
//handle muting and automuting
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
src << "<font color='red'>Error: Admin-PM: You cannot send adminhelps (Muted).</font>"
|
||||
return
|
||||
|
||||
if (src.handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
if(src.handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
return
|
||||
|
||||
/**src.verbs -= /client/verb/adminhelp
|
||||
|
||||
spawn(1200)
|
||||
src.verbs += /client/verb/adminhelp // 2 minute cool-down for adminhelps
|
||||
src.verbs += /client/verb/adminhelp // 2 minute cool-down for adminhelps//Go to hell
|
||||
**/
|
||||
|
||||
//clean the input msg
|
||||
if(!msg) return
|
||||
msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
|
||||
if (!msg) return
|
||||
|
||||
if(!msg) return
|
||||
var/original_msg = msg
|
||||
|
||||
//The symbol <20> (fancy multiplication sign) will be used to mark where to put replacements, so the original message must not contain it.
|
||||
msg = replacetext(msg, "<22>", "")
|
||||
msg = replacetext(msg, "HOLDERREF", "HOLDER-REF") //HOLDERREF is a key word which gets replaced with the admin's holder ref later on, so it mustn't be in the original message
|
||||
msg = replacetext(msg, "ADMINREF", "ADMIN-REF") //ADMINREF is a key word which gets replaced with the admin's client's ref. So it mustn't be in the original message.
|
||||
|
||||
//explode the input msg into a list
|
||||
var/list/msglist = text2list(msg, " ")
|
||||
|
||||
var/list/mob/mobs = list()
|
||||
|
||||
//generate keywords lookup
|
||||
var/list/surnames = list()
|
||||
var/list/forenames = list()
|
||||
var/list/ckeys = list()
|
||||
for(var/mob/M in mob_list)
|
||||
mobs += M
|
||||
var/list/indexing = list(M.real_name, M.name)
|
||||
if(M.mind) indexing += M.mind.name
|
||||
|
||||
var/list/replacement_value = list() //When a word match is found, the word matched will get replaced with an <20> (fancy multiplication symbol).
|
||||
//This list will contain a list of values which the <20> will be replaced with in the same order as indexes in this list.
|
||||
//So if this list has the value list("John","Jane") and msg is, at the end, "This is <20> and he griffed <20>" the text to
|
||||
//display will be "This is John and he griffe Jane". The strings in this list are a bit more complex than 'John' and 'Jane' tho.
|
||||
|
||||
var/ai_found = 0 //If an AI name or 'ai' word is found in the text, the additional (CL) = Check Laws button gets added. Not added every time so it doesn't spam.
|
||||
|
||||
//we will try to locate each word of the message in our lists of names and clients
|
||||
//for each mob that we have found
|
||||
//split the mob's info into a list. "John Arnolds" becomes list("John","Arnolds") so we can iterate through this
|
||||
//for each of the name parts IE. "John", "Arnolds", etc. in the current name.
|
||||
for(var/i = 1; i <= msglist.len; i++)
|
||||
var/word = msglist[i]
|
||||
var/original_word = word
|
||||
word = replacetext(word, ".", "")
|
||||
word = replacetext(word, ",", "")
|
||||
word = replacetext(word, "!", "")
|
||||
word = replacetext(word, "?", "") //Strips some common punctuation characters so the actual word can be better compared.
|
||||
word = replacetext(word, ";", "")
|
||||
word = replacetext(word, ":", "")
|
||||
word = replacetext(word, "(", "")
|
||||
word = replacetext(word, ")", "")
|
||||
if(lowertext(word) in adminhelp_ignored_words)
|
||||
continue
|
||||
if(lowertext(word) == "ai")
|
||||
ai_found = 1
|
||||
continue
|
||||
for(var/mob/M in mobs)
|
||||
var/list/namelist = text2list("[M.name] [M.real_name] [(M.mind)?"[M.mind.name]":""] [M.ckey] [M.key]", " ")
|
||||
var/word_is_match = 0 //Used to break from this mob for loop if a match is found
|
||||
for(var/namepart in namelist)
|
||||
if( lowertext(word) == lowertext(namepart) )
|
||||
msglist[i] = "<22>"
|
||||
var/description_string = "<b><font color='black'>[original_word] (<A HREF='?src=HOLDERREF;adminmoreinfo=\ref[M]'>?</A>)</font></b>"
|
||||
replacement_value += description_string
|
||||
mobs -= M //If a mob is found then remove it from the list of mobs, so we don't get the same mob reported a million times.
|
||||
word_is_match = 1
|
||||
for(var/string in indexing)
|
||||
var/list/L = text2list(string, " ")
|
||||
var/surname_found = 0
|
||||
//surnames
|
||||
for(var/i=L.len, i>=1, i--)
|
||||
var/word = ckey(L[i])
|
||||
if(word)
|
||||
surnames[word] = M
|
||||
surname_found = i
|
||||
break
|
||||
if(word_is_match)
|
||||
if(isAI(M))
|
||||
//forenames
|
||||
for(var/i=1, i<surname_found, i++)
|
||||
var/word = ckey(L[i])
|
||||
if(word)
|
||||
forenames[word] = M
|
||||
//ckeys
|
||||
ckeys[M.ckey] = M
|
||||
|
||||
var/ai_found = 0
|
||||
msg = ""
|
||||
var/list/mobs_found = list()
|
||||
for(var/original_word in msglist)
|
||||
var/word = ckey(original_word)
|
||||
if(word)
|
||||
if(!(word in adminhelp_ignored_words))
|
||||
if(word == "ai")
|
||||
ai_found = 1
|
||||
break //Breaks execution of the mob loop, since a match was already found.
|
||||
else
|
||||
var/mob/found = ckeys[word]
|
||||
if(!found)
|
||||
found = surnames[word]
|
||||
if(!found)
|
||||
found = forenames[word]
|
||||
if(found)
|
||||
if(!(found in mobs_found))
|
||||
mobs_found += found
|
||||
if(!ai_found && isAI(found))
|
||||
ai_found = 1
|
||||
msg += "<b><font color='black'>[original_word] (<A HREF='?_src_=holder;adminmoreinfo=\ref[found]'>?</A>)</font></b> "
|
||||
continue
|
||||
msg += "[original_word] "
|
||||
|
||||
var/j = 1 //index to the next element in the replacement_value list
|
||||
for(var/i = 1; i <= msglist.len; i++)
|
||||
var/word = msglist[i]
|
||||
if(word == "<22>")
|
||||
msglist[i] = replacement_value[j]
|
||||
j++
|
||||
if(!mob) return //this doesn't happen
|
||||
|
||||
msg = dd_list2text(msglist, " ")
|
||||
var/ref_mob = "\ref[mob]"
|
||||
msg = "\blue <b><font color=red>HELP: </font>[key_name(src, 1)] (<A HREF='?_src_=holder;adminmoreinfo=[ref_mob]'>?</A>) (<A HREF='?_src_=holder;adminplayeropts=[ref_mob]'>PP</A>) (<A HREF='?_src_=vars;Vars=[ref_mob]'>VV</A>) (<A HREF='?_src_=holder;subtlemessage=[ref_mob]'>SM</A>) (<A HREF='?_src_=holder;adminplayerobservejump=[ref_mob]'>JMP</A>) (<A HREF='?_src_=holder;secretsadmin=check_antagonist'>CA</A>) [ai_found ? " (<A HREF='?_src_=holder;adminchecklaws=[ref_mob]'>CL</A>)" : ""]:</b> [msg]"
|
||||
|
||||
//send this msg to all admins
|
||||
var/admin_number_afk = 0
|
||||
for(var/client/X in admins)
|
||||
if(X.is_afk())
|
||||
admin_number_afk++
|
||||
if(X.prefs.toggles & SOUND_ADMINHELP)
|
||||
X << 'sound/effects/adminhelp.ogg'
|
||||
X << msg
|
||||
|
||||
if(mob)
|
||||
var/ref_mob = "\ref[src.mob]"
|
||||
for(var/client/X in admins)
|
||||
if( X.inactivity > AFK_THRESHOLD ) //When I made this, the AFK_THRESHOLD was 3000ds = 300s = 5m, see setup.dm for the new one.
|
||||
admin_number_afk++
|
||||
if(X.holder.sound_adminhelp)
|
||||
X << 'sound/effects/adminhelp.ogg'
|
||||
var/check_laws_text = ""
|
||||
if(ai_found)
|
||||
check_laws_text = (" (<A HREF='?src=\ref[X.holder];adminchecklaws=[ref_mob]'>CL</A>)")
|
||||
|
||||
var/msg_to_send = "\blue <b><font color=red>HELP: </font>[key_name(src, X)] (<A HREF='?src=\ref[X.holder];adminmoreinfo=[ref_mob]'>?</A>) (<A HREF='?src=\ref[X.holder];adminplayeropts=[ref_mob]'>PP</A>) (<A HREF='?src=\ref[X.holder];adminplayervars=[ref_mob]'>VV</A>) (<A HREF='?src=\ref[X.holder];subtlemessage=[ref_mob]'>SM</A>) (<A HREF='?src=\ref[X.holder];adminplayerobservejump=[ref_mob]'>JMP</A>) (<A HREF='?src=\ref[X.holder];secretsadmin=check_antagonist'>CA</A>) [check_laws_text]:</b> [msg]"
|
||||
msg_to_send = replacetext(msg_to_send, "HOLDERREF", "\ref[X.holder]")
|
||||
msg_to_send = replacetext(msg_to_send, "ADMINREF", "\ref[X]")
|
||||
X << msg_to_send
|
||||
else
|
||||
var/ref_client = "\ref[src]"
|
||||
for(var/client/X in admins)
|
||||
if( X.inactivity > AFK_THRESHOLD ) //When I made this, the AFK_THRESHOLD was 3000ds = 300s = 5m, see setup.dm for the new one.
|
||||
admin_number_afk++
|
||||
if(X.holder.sound_adminhelp)
|
||||
X << 'sound/effects/adminhelp.ogg'
|
||||
var/msg_to_send = "\blue <b><font color=red>HELP: </font>[key_name(src, X)] (<A HREF='?src=\ref[X.holder];adminplayervars=[ref_client]'>VV</A>) (<A HREF='?src=\ref[X.holder];secretsadmin=check_antagonist'>CA</A>):</b> [msg]"
|
||||
msg_to_send = replacetext(msg_to_send, "HOLDERREF", "\ref[X.holder]")
|
||||
msg_to_send = replacetext(msg_to_send, "ADMINREF", "\ref[X]")
|
||||
X << msg_to_send
|
||||
var/admin_number_present = admins.len - admin_number_afk
|
||||
//show it to the person adminhelping too
|
||||
src << "<font color='blue'>PM to-<b>Admins</b>: [original_msg]</font>"
|
||||
|
||||
var/admin_number_present = admins.len - admin_number_afk
|
||||
log_admin("HELP: [key_name(src)]: [original_msg] - heard by [admin_number_present] non-AFK admins.")
|
||||
if(admin_number_present <= 0)
|
||||
if(!admin_number_afk)
|
||||
|
||||
Reference in New Issue
Block a user