chat.lua 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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. "<n> <v> fell apart under <an_angry_k>'s <angry>attack.",
  225. "<an_angry_k>'s <w> apparently wasn't such an unusual weapon after all, as <n> <v> found out.",
  226. "<an_angry_k> <brutally><slew> <n> <v> with great prejudice.",
  227. "<n> <v> died from <an_angry_k>'s horrid slaying.",
  228. "<n> <v> fell prey to <an_angry_k>'s deadly <w>.",
  229. "<an_angry_k> went out of <k_his> way to <slay> <n> <v> with <k_his> <w>.",
  230. "<n> <v> danced <v_himself> to death under <an_angry_k>'s craftily wielded <w>.",
  231. "<an_angry_k> used <k_his> <w> to <slay> <n> <v> with prejudice.",
  232. "<an_angry_k> made a splortching sound with <n> <v>'s head.",
  233. "<n> <v> was <slain> by <an_angry_k>'s skillfully handled <w>.",
  234. "<n> <v> became prey for <an_angry_k>.",
  235. "<n> <v> didn't get out of <an_angry_k>'s way in time.",
  236. "<n> <v> SAW <an_angry_k> coming with <k_his> <w>. Didn't get away in time.",
  237. "<n> <v> made no real attempt to get out of <an_angry_k>'s way.",
  238. "<an_angry_k> barreled through <n> <v> as if <v_he> wasn't there.",
  239. "<an_angry_k> sent <n> <v> to that place where kindling wood isn't needed.",
  240. "<n> <v> didn't suspect that <an_angry_k> meant <v_him> any <pain>.",
  241. "<n> <v> fought <an_angry_k> to the death and lost painfully.",
  242. "<n> <v> knew <an_angry_k> was wielding <k_his> <w> but didn't guess what <k> meant to do with it.",
  243. "<an_angry_k> <brutally>clonked <n> <v> over the head using <k_his> <w> with silent skill.",
  244. "<an_angry_k> made sure <n> <v> didn't see that coming!",
  245. "<an_angry_k> has decided <k_his> favorite weapon is <k_his> <w>.",
  246. "<n> <v> did the mad hatter dance just before being <slain> with <an_angry_k>'s <w>.",
  247. "<n> <v> played the victim to <an_angry_k>'s bully behavior!",
  248. "<an_angry_k> used <n> <v> for weapons practice with <k_his> <w>.",
  249. "<n> <v> failed to avoid <an_angry_k>'s oncoming weapon.",
  250. "<an_angry_k> successfully got <n> <v> to complain of a headache.",
  251. "<n> <v> got <v_himself> some serious hurt from <an_angry_k>'s <w>.",
  252. "Trying to talk peace to <an_angry_k> didn't win any for <n> <v>.",
  253. "<n> <v> was <brutally><slain> by <an_angry_k>'s <w>.",
  254. "<n> <v> jumped the mad-hatter dance under <an_angry_k>'s <w>.",
  255. "<n> <v> got <v_himself> a fatal mauling by <an_angry_k>'s <w>.",
  256. "<an_angry_k> <brutally><slew> <n> <v> with <k_his> <w>.",
  257. "<an_angry_k> split <n> <v>'s wig.",
  258. "<an_angry_k> took revenge on <n> <v>.",
  259. "<an_angry_k> <brutally><slew> <n> <v>.",
  260. "<n> <v> played dead. Permanently.",
  261. "<n> <v> never saw what hit <v_him>.",
  262. "<an_angry_k> took <n> <v> by surprise.",
  263. "<n> <v> was <brutally><slain>.",
  264. "<an_angry_k> didn't take any prisoners from <n> <v>.",
  265. "<an_angry_k> <brutally>pinned <n> <v> to the wall with <k_his> <w>.",
  266. "<n> <v> failed <v_his> weapon checks.",
  267. "<k> eliminated <n> <v>.",
  268. }
  269. local message_spam_avoidance = {}
  270. function mobs.player_killed_mob(self, player)
  271. local pname = player:get_player_name()
  272. if message_spam_avoidance[pname] then
  273. return
  274. end
  275. -- Don't betray the presence of the admin going on a trash run.
  276. if gdac_invis.is_invisible(pname) then
  277. return
  278. end
  279. local mname = utility.get_short_desc(self.description or "mob")
  280. local msg = murder_messages[random(1, #murder_messages)]
  281. msg = string.gsub(msg, "<v>", mname)
  282. local ksex = skins.get_gender_strings(pname)
  283. local vsex = skins.get_random_standard_gender(5) -- 5% female.
  284. msg = string.gsub(msg, "<k_himself>", ksex.himself)
  285. msg = string.gsub(msg, "<k_his>", ksex.his)
  286. msg = string.gsub(msg, "<v_himself>", vsex.himself)
  287. msg = string.gsub(msg, "<v_his>", vsex.his)
  288. msg = string.gsub(msg, "<v_him>", vsex.him)
  289. msg = string.gsub(msg, "<v_he>", vsex.he)
  290. if string.find(msg, "<brutally>") then
  291. local adv = kill_adv[random(1, #kill_adv)]
  292. if adv ~= "" then
  293. adv = adv .. " "
  294. end
  295. msg = string.gsub(msg, "<brutally>", adv)
  296. end
  297. if string.find(msg, "<slain>") then
  298. local adj = kill_adj[random(1, #kill_adj)]
  299. msg = string.gsub(msg, "<slain>", adj)
  300. end
  301. if string.find(msg, "<slew>") then
  302. local adj = kill_adj2[random(1, #kill_adj2)]
  303. msg = string.gsub(msg, "<slew>", adj)
  304. end
  305. if string.find(msg, "<slay>") then
  306. local adj = kill_adj3[random(1, #kill_adj3)]
  307. msg = string.gsub(msg, "<slay>", adj)
  308. end
  309. if string.find(msg, "<pain>") then
  310. local adj = pain_words[random(1, #pain_words)]
  311. msg = string.gsub(msg, "<pain>", adj)
  312. end
  313. if string.find(msg, "<angry>") then
  314. local ang = kill_ang[random(1, #kill_ang)]
  315. if ang ~= "" then
  316. ang = ang .. " "
  317. end
  318. msg = string.gsub(msg, "<angry>", ang)
  319. end
  320. if string.find(msg, "<an_angry_k>") then
  321. local replace = ""
  322. local angry = kill_ang[random(1, #kill_ang)]
  323. if angry ~= "" then
  324. local an = "a"
  325. if angry:find("^[aeiouAEIOU]") then
  326. an = "an"
  327. end
  328. replace = an .. " " .. angry .. " "
  329. end
  330. local name = ""
  331. if cloaking.is_cloaked(pname) or player_labels.query_nametag_onoff(pname) == false then
  332. if replace == "" then
  333. name = "an explorer"
  334. else
  335. name = "explorer"
  336. end
  337. replace = replace .. name
  338. else
  339. replace = replace .. "<" .. rename.gpn(pname) .. ">"
  340. end
  341. msg = string.gsub(msg, "<an_angry_k>", replace)
  342. end
  343. if msg:find("<k>") then
  344. local replace = "<" .. rename.gpn(pname) .. ">"
  345. if cloaking.is_cloaked(pname) or player_labels.query_nametag_onoff(pname) == false then
  346. replace = "an explorer"
  347. end
  348. msg = msg:gsub("<k>", replace)
  349. end
  350. if string.find(msg, "<n>") then
  351. local an = "a"
  352. if mname:find("^[aeiouAEIOU]") then
  353. an = "an"
  354. end
  355. msg = string.gsub(msg, "<n>", an)
  356. end
  357. -- Get weapon description.
  358. if string.find(msg, "<w>") then
  359. local wield = player:get_wielded_item()
  360. local def = minetest.registered_items[wield:get_name()]
  361. local meta = wield:get_meta()
  362. local description = meta:get_string("description")
  363. if description ~= "" then
  364. msg = string.gsub(msg, "<w>", "'" .. utility.get_short_desc(description):trim() .. "'")
  365. elseif def and def.description then
  366. local str = utility.get_short_desc(def.description)
  367. if str == "" then
  368. str = "Potato Fist"
  369. end
  370. msg = string.gsub(msg, "<w>", str)
  371. end
  372. end
  373. -- Make first character uppercase.
  374. msg = string.upper(msg:sub(1, 1)) .. msg:sub(2)
  375. msg = string.gsub(msg, "%s+", " ") -- Remove duplicate spaces.
  376. msg = string.gsub(msg, " %.$", ".") -- Remove space before period.
  377. minetest.chat_send_all("# Server: " .. msg)
  378. message_spam_avoidance[pname] = {}
  379. minetest.after(random(10, 60*2), function()
  380. message_spam_avoidance[pname] = nil
  381. end)
  382. end