chat.lua 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. local random = math.random
  2. local kill_adj = {
  3. "killed",
  4. "slain",
  5. "slaughtered",
  6. "mauled",
  7. "murdered",
  8. "pwned",
  9. "owned",
  10. "dispatched",
  11. "neutralized",
  12. "wasted",
  13. "polished off",
  14. "rubbed out",
  15. "snuffed out",
  16. "assassinated",
  17. "annulled",
  18. "destroyed",
  19. "finished off",
  20. "terminated",
  21. "wiped out",
  22. "scrubbed",
  23. "abolished",
  24. "obliterated",
  25. "voided",
  26. "ended",
  27. "annihilated",
  28. "undone",
  29. "nullified",
  30. "exterminated",
  31. }
  32. local kill_adj2 = {
  33. "killed",
  34. "slew",
  35. "slaughtered",
  36. "mauled",
  37. "murdered",
  38. "pwned",
  39. "owned",
  40. "dispatched",
  41. "neutralized",
  42. "wasted",
  43. "polished off",
  44. "rubbed out",
  45. "snuffed out",
  46. "assassinated",
  47. "annulled",
  48. "destroyed",
  49. "finished off",
  50. "terminated",
  51. "wiped out",
  52. "scrubbed",
  53. "abolished",
  54. "obliterated",
  55. "voided",
  56. "ended",
  57. "annihilated",
  58. "undid",
  59. "nullified",
  60. "exterminated",
  61. }
  62. local kill_adj3 = {
  63. "kill",
  64. "slay",
  65. "slaughter",
  66. "maul",
  67. "murder",
  68. "pwn",
  69. "own",
  70. "dispatch",
  71. "neutralize",
  72. "waste",
  73. "polish off",
  74. "rub out",
  75. "snuff out",
  76. "assassinate",
  77. "annul",
  78. "destroy",
  79. "finish off",
  80. "terminate",
  81. "wipe out",
  82. "scrub",
  83. "abolish",
  84. "obliterate",
  85. "void",
  86. "end",
  87. "annihilate",
  88. "undo",
  89. "nullify",
  90. "exterminate",
  91. }
  92. local kill_adv = {
  93. "brutally",
  94. "",
  95. "swiftly",
  96. "",
  97. "savagely",
  98. "",
  99. "viciously",
  100. "",
  101. "uncivilly",
  102. "",
  103. "barbarously",
  104. "",
  105. "ruthlessly",
  106. "",
  107. "ferociously",
  108. "",
  109. "rudely",
  110. "",
  111. "cruelly",
  112. "",
  113. }
  114. local kill_ang = {
  115. "angry",
  116. "",
  117. "PO'ed",
  118. "",
  119. "furious",
  120. "",
  121. "disgusted",
  122. "",
  123. "infuriated",
  124. "",
  125. "annoyed",
  126. "",
  127. "irritated",
  128. "",
  129. "bitter",
  130. "",
  131. "offended",
  132. "",
  133. "outraged",
  134. "",
  135. "irate",
  136. "",
  137. "enraged",
  138. "",
  139. "indignant",
  140. "",
  141. "irritable",
  142. "",
  143. "cross",
  144. "",
  145. "riled",
  146. "",
  147. "vexed",
  148. "",
  149. "wrathful",
  150. "",
  151. "fierce",
  152. "",
  153. "displeased",
  154. "",
  155. "irascible",
  156. "",
  157. "ireful",
  158. "",
  159. "sulky",
  160. "",
  161. "ill-tempered",
  162. "",
  163. "vehement",
  164. "",
  165. "raging",
  166. "",
  167. "incensed",
  168. "",
  169. "frenzied",
  170. "",
  171. "enthusiastic",
  172. "",
  173. "fuming",
  174. "",
  175. "cranky",
  176. "",
  177. "peevish",
  178. "",
  179. "belligerent",
  180. "",
  181. }
  182. function mobs.mob_killed_player(self, player)
  183. local pname = player:get_player_name()
  184. -- Don't betray the presence of admin on his usual testing runs.
  185. if gdac_invis.is_invisible(pname) then
  186. return
  187. end
  188. local mname = utility.get_short_desc(self.description or "mob")
  189. local adv = kill_adv[random(1, #kill_adv)]
  190. if adv ~= "" then
  191. adv = adv .. " "
  192. end
  193. local adj = kill_adj[random(1, #kill_adj)]
  194. local ang = kill_ang[random(1, #kill_ang)]
  195. if ang ~= "" then
  196. ang = ang .. " "
  197. end
  198. local an = "a"
  199. if ang ~= "" then
  200. if ang:find("^[aeiouAEIOU]") then
  201. an = "an"
  202. end
  203. else
  204. if mname:find("^[aeiouAEIOU]") then
  205. an = "an"
  206. end
  207. end
  208. local victim = "<" .. rename.gpn(pname) .. ">"
  209. if cloaking.is_cloaked(pname) or player_labels.query_nametag_onoff(pname) == false then
  210. victim = "An explorer"
  211. end
  212. minetest.chat_send_all("# Server: " .. victim .. " was " .. adv .. adj .. " by " .. an .. " " .. ang .. mname .. ".")
  213. end
  214. local pain_words = {
  215. "harm",
  216. "pain",
  217. "grief",
  218. "trouble",
  219. "evil",
  220. "ill will",
  221. }
  222. local murder_messages = {
  223. "<n> <v> collapsed from <an_angry_k>'s <angry>attack.",
  224. "<an_angry_k>'s <w> apparently wasn't such an unusual weapon after all, as <n> <v> found out.",
  225. "<an_angry_k> <brutally><slew> <n> <v> with great prejudice.",
  226. "<n> <v> died from <an_angry_k>'s horrid slaying.",
  227. "<n> <v> fell prey to <an_angry_k>'s deadly <w>.",
  228. "<an_angry_k> went out of <k_his> way to <slay> <n> <v> with <k_his> <w>.",
  229. "<n> <v> danced <v_himself> to death under <an_angry_k>'s craftily wielded <w>.",
  230. "<an_angry_k> used <k_his> <w> to <slay> <n> <v> with prejudice.",
  231. "<an_angry_k> made a splortching sound with <n> <v>'s head.",
  232. "<n> <v> was <slain> by <an_angry_k>'s skillfully handled <w>.",
  233. "<n> <v> became prey for <an_angry_k>.",
  234. "<n> <v> didn't get out of <an_angry_k>'s way in time.",
  235. "<n> <v> SAW <an_angry_k> coming with <k_his> <w>. Didn't get away in time.",
  236. "<n> <v> made no real attempt to get out of <an_angry_k>'s way.",
  237. "<an_angry_k> barreled through <n> <v> as if <v_he> wasn't there.",
  238. "<an_angry_k> sent <n> <v> to that place where kindling wood isn't needed.",
  239. "<n> <v> didn't suspect that <an_angry_k> meant <v_him> any <pain>.",
  240. "<n> <v> fought <an_angry_k> to the death and lost painfully.",
  241. "<n> <v> knew <an_angry_k> was wielding <k_his> <w> but didn't guess what <k> meant to do with it.",
  242. "<an_angry_k> <brutally>clonked <n> <v> over the head using <k_his> <w> with silent skill.",
  243. "<an_angry_k> made sure <n> <v> didn't see that coming!",
  244. "<an_angry_k> has decided <k_his> favorite weapon is <k_his> <w>.",
  245. "<n> <v> did the mad hatter dance just before being <slain> with <an_angry_k>'s <w>.",
  246. "<n> <v> played the victim to <an_angry_k>'s bully behavior!",
  247. "<an_angry_k> used <n> <v> for weapons practice with <k_his> <w>.",
  248. "<n> <v> failed to avoid <an_angry_k>'s oncoming weapon.",
  249. "<an_angry_k> successfully got <n> <v> to complain of a headache.",
  250. "<n> <v> got <v_himself> some serious hurt from <an_angry_k>'s <w>.",
  251. "Trying to talk peace to <an_angry_k> didn't win any for <n> <v>.",
  252. "<n> <v> was <brutally><slain> by <an_angry_k>'s <w>.",
  253. "<n> <v> jumped the mad-hatter dance under <an_angry_k>'s <w>.",
  254. "<n> <v> got <v_himself> a fatal mauling by <an_angry_k>'s <w>.",
  255. "<an_angry_k> <brutally><slew> <n> <v> with <k_his> <w>.",
  256. "<an_angry_k> split <n> <v>'s wig.",
  257. "<an_angry_k> took revenge on <n> <v>.",
  258. "<an_angry_k> <brutally><slew> <n> <v>.",
  259. "<n> <v> played dead. Permanently.",
  260. "<n> <v> never saw what hit <v_him>.",
  261. "<an_angry_k> took <n> <v> by surprise.",
  262. "<n> <v> was <brutally><slain>.",
  263. "<an_angry_k> didn't take any prisoners from <n> <v>.",
  264. "<an_angry_k> <brutally>pinned <n> <v> to the wall with <k_his> <w>.",
  265. "<n> <v> failed <v_his> weapon checks.",
  266. "<k> eliminated <n> <v>.",
  267. }
  268. local message_spam_avoidance = {}
  269. function mobs.player_killed_mob(self, player)
  270. local pname = player:get_player_name()
  271. if message_spam_avoidance[pname] then
  272. return
  273. end
  274. -- Don't betray the presence of the admin going on a trash run.
  275. if gdac_invis.is_invisible(pname) then
  276. return
  277. end
  278. local mname = utility.get_short_desc(self.description or "mob")
  279. local msg = murder_messages[random(1, #murder_messages)]
  280. msg = string.gsub(msg, "<v>", mname)
  281. local ksex = skins.get_gender_strings(pname)
  282. local vsex = skins.get_random_standard_gender(5) -- 5% female.
  283. msg = string.gsub(msg, "<k_himself>", ksex.himself)
  284. msg = string.gsub(msg, "<k_his>", ksex.his)
  285. msg = string.gsub(msg, "<v_himself>", vsex.himself)
  286. msg = string.gsub(msg, "<v_his>", vsex.his)
  287. msg = string.gsub(msg, "<v_him>", vsex.him)
  288. msg = string.gsub(msg, "<v_he>", vsex.he)
  289. if string.find(msg, "<brutally>") then
  290. local adv = kill_adv[random(1, #kill_adv)]
  291. if adv ~= "" then
  292. adv = adv .. " "
  293. end
  294. msg = string.gsub(msg, "<brutally>", adv)
  295. end
  296. if string.find(msg, "<slain>") then
  297. local adj = kill_adj[random(1, #kill_adj)]
  298. msg = string.gsub(msg, "<slain>", adj)
  299. end
  300. if string.find(msg, "<slew>") then
  301. local adj = kill_adj2[random(1, #kill_adj2)]
  302. msg = string.gsub(msg, "<slew>", adj)
  303. end
  304. if string.find(msg, "<slay>") then
  305. local adj = kill_adj3[random(1, #kill_adj3)]
  306. msg = string.gsub(msg, "<slay>", adj)
  307. end
  308. if string.find(msg, "<pain>") then
  309. local adj = pain_words[random(1, #pain_words)]
  310. msg = string.gsub(msg, "<pain>", adj)
  311. end
  312. if string.find(msg, "<angry>") then
  313. local ang = kill_ang[random(1, #kill_ang)]
  314. if ang ~= "" then
  315. ang = ang .. " "
  316. end
  317. msg = string.gsub(msg, "<angry>", ang)
  318. end
  319. if string.find(msg, "<an_angry_k>") then
  320. local replace = ""
  321. local angry = kill_ang[random(1, #kill_ang)]
  322. if angry ~= "" then
  323. local an = "a"
  324. if angry:find("^[aeiouAEIOU]") then
  325. an = "an"
  326. end
  327. replace = an .. " " .. angry .. " "
  328. end
  329. local name = ""
  330. if cloaking.is_cloaked(pname) or player_labels.query_nametag_onoff(pname) == false then
  331. if replace == "" then
  332. name = "an explorer"
  333. else
  334. name = "explorer"
  335. end
  336. replace = replace .. name
  337. else
  338. replace = replace .. "<" .. rename.gpn(pname) .. ">"
  339. end
  340. msg = string.gsub(msg, "<an_angry_k>", replace)
  341. end
  342. if msg:find("<k>") then
  343. local replace = "<" .. rename.gpn(pname) .. ">"
  344. if cloaking.is_cloaked(pname) or player_labels.query_nametag_onoff(pname) == false then
  345. replace = "an explorer"
  346. end
  347. msg = msg:gsub("<k>", replace)
  348. end
  349. if string.find(msg, "<n>") then
  350. local an = "a"
  351. if mname:find("^[aeiouAEIOU]") then
  352. an = "an"
  353. end
  354. msg = string.gsub(msg, "<n>", an)
  355. end
  356. -- Get weapon description.
  357. if string.find(msg, "<w>") then
  358. local wield = player:get_wielded_item()
  359. local def = minetest.registered_items[wield:get_name()]
  360. local meta = wield:get_meta()
  361. local description = meta:get_string("description")
  362. if description ~= "" then
  363. msg = string.gsub(msg, "<w>", "'" .. utility.get_short_desc(description):trim() .. "'")
  364. elseif def and def.description then
  365. local str = utility.get_short_desc(def.description)
  366. if str == "" then
  367. str = "Potato Fist"
  368. end
  369. msg = string.gsub(msg, "<w>", str)
  370. end
  371. end
  372. -- Make first character uppercase.
  373. msg = string.upper(msg:sub(1, 1)) .. msg:sub(2)
  374. msg = string.gsub(msg, "%s+", " ") -- Remove duplicate spaces.
  375. msg = string.gsub(msg, " %.$", ".") -- Remove space before period.
  376. minetest.chat_send_all("# Server: " .. msg)
  377. message_spam_avoidance[pname] = {}
  378. minetest.after(random(10, 60*2), function()
  379. message_spam_avoidance[pname] = nil
  380. end)
  381. end