init.lua 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. -- For the future:
  2. -- Reduce checks if the server is laggy (globalstep is slowed down).
  3. -- * Requires: a reliable way to determine current server lag.
  4. -- Increase checks on a player if others report them for cheating.
  5. -- * Requires: a reliable way for players to report cheaters that is not
  6. -- * trivially open to abuse.
  7. -- This line was added by Dresdan.
  8. -- I'm ganna learn today boys.
  9. -- im ganna make flowers
  10. -- This is Nakilashiva. I'm ganna lorn too.
  11. ac = ac or {}
  12. ac.modpath = minetest.get_modpath("ac")
  13. ac.wpath = minetest.get_worldpath()
  14. ac.players = ac.players or {} -- Per-player data for this session ONLY.
  15. -- Random delay to first check on player's first join (this session).
  16. ac.initial_delay_min = 1
  17. ac.initial_delay_max = 20
  18. -- Default (base) random delay between player checks.
  19. ac.default_delay_min = 5
  20. ac.default_delay_max = 30
  21. -- Random time to decrease between checks for players in city areas.
  22. ac.city_reduce_min = 1
  23. ac.city_reduce_max = 20
  24. -- Random time to add between checks for players in outlands.
  25. ac.outland_increase_min = 5
  26. ac.outland_increase_max = 30
  27. -- The average amounts of accumulated suspicion per session considered low/high.
  28. -- Average suspicion is calculated by total suspicion ever recorded, divided by
  29. -- number of clean sessions in which no suspicion was recorded (for that player).
  30. ac.low_average_suspicion = 5
  31. ac.high_average_suspicion = 20
  32. -- Random time to decrease between checks for players with high avg suspicion.
  33. ac.high_suspicion_reduce_min = 1
  34. ac.high_suspicion_reduce_max = 10
  35. -- Random time to add between checks for players with low suspicion.
  36. ac.low_suspicion_increase_min = 1
  37. ac.low_suspicion_increase_max = 10
  38. -- Once accumulated suspicion for a single session (not including total suspicion
  39. -- over all sessions) exceeds this amount, player is registered as a confirmed
  40. -- cheater. Note that the player will not automatically be registered as a cheater
  41. -- if they merely have high avg suspicion over multiple sessions.
  42. ac.cheat_registration_threshold = 50
  43. ac.admin_name = "MustTest"
  44. -- Localize for performance.
  45. local vector_distance = vector.distance
  46. local vector_round = vector.round
  47. local math_floor = math.floor
  48. local math_random = math.random
  49. -- Open logfile if not already opened.
  50. if not ac.logfile then
  51. -- Open file in append mode.
  52. ac.logfile = io.open(ac.wpath .. "/ac.txt", "a")
  53. end
  54. -- Open mod storage if not already opened.
  55. if not ac.storage then
  56. ac.storage = minetest.get_mod_storage()
  57. end
  58. function ac.get_suspicion_count(pname)
  59. if ac.players[pname] then
  60. if ac.players[pname].suspicion_count then
  61. -- Must be a non-negative integer.
  62. return ac.players[pname].suspicion_count
  63. end
  64. end
  65. return 0
  66. end
  67. -- Get timestamp of the last time a cheat was detected by the standard checking
  68. -- function (and its confirmation spawns), not including cheats detected along a
  69. -- path.
  70. function ac.get_last_cheat_time(pname)
  71. if ac.players[pname] then
  72. if ac.players[pname].last_cheat_time then
  73. return ac.players[pname].last_cheat_time
  74. end
  75. end
  76. return 0
  77. end
  78. function ac.get_total_suspicion(pname)
  79. if ac.players[pname] then
  80. local cs = ac.get_suspicion_count(pname)
  81. if ac.players[pname].total_suspicion then
  82. -- Must be a non-negative integer.
  83. return ac.players[pname].total_suspicion + cs
  84. end
  85. local k = pname .. ":total_suspicion"
  86. local ts = ac.storage:get_int(k)
  87. ac.players[pname].total_suspicion = ts
  88. return ts + cs
  89. else
  90. local cs = ac.get_suspicion_count(pname)
  91. local k = pname .. ":total_suspicion"
  92. local ts = ac.storage:get_int(k)
  93. ac.players[pname] = {total_suspicion=ts}
  94. return ts + cs
  95. end
  96. return 0
  97. end
  98. function ac.get_clean_sessions(pname)
  99. if ac.players[pname] then
  100. if ac.players[pname].clean_sessions then
  101. -- Must be a non-negative integer.
  102. return ac.players[pname].clean_sessions
  103. end
  104. local k = pname .. ":clean_sessions"
  105. local cc = ac.storage:get_int(k)
  106. ac.players[pname].clean_sessions = cc
  107. return cc
  108. else
  109. local k = pname .. ":clean_sessions"
  110. local cc = ac.storage:get_int(k)
  111. ac.players[pname] = {clean_sessions=cc}
  112. return cc
  113. end
  114. return 0
  115. end
  116. function ac.get_position_at_last_check_or_nil(pname)
  117. if ac.players[pname] then
  118. if ac.players[pname].last_pos then
  119. return ac.players[pname].last_pos
  120. end
  121. end
  122. end
  123. -- Log to file.
  124. function ac.log_suspicious_act(pname, pos, time, act)
  125. local s = pname .. "|" .. act .. "|" .. time .. "|" ..
  126. math_floor(pos.x) .. "," .. math_floor(pos.y) .. "," .. math_floor(pos.z) ..
  127. "|" .. ac.get_suspicion_count(pname) .. "\n"
  128. ac.logfile:write(s)
  129. ac.logfile:flush()
  130. end
  131. -- Record in current session memory.
  132. -- Note: this may be called out of sequence! Therefore we shouldn't use current
  133. -- time or player's current position.
  134. function ac.record_suspicious_act(pname, time, act)
  135. local pdata = ac.players[pname]
  136. if not pdata then
  137. ac.players[pname] = {}
  138. pdata = ac.players[pname]
  139. end
  140. -- Increment suspicion count.
  141. pdata.suspicion_count = (pdata.suspicion_count or 0) + 1
  142. if act == "fly" then
  143. pdata.fly_count = (pdata.fly_count or 0) + 1
  144. elseif act == "clip" then
  145. pdata.clip_count = (pdata.clip_count or 0) + 1
  146. end
  147. -- This is used for recording the most recent last time when a cheat was
  148. -- detected by the cheat-confirmation functions. This should be nil when we're
  149. -- checking a path, as that is considered "a separate feature". Cheats detected
  150. -- along a path should all be considered part of the same "instance" of cheating,
  151. -- so we don't record timestamps in that case.
  152. if time ~= nil then
  153. pdata.last_cheat_time = time
  154. end
  155. end
  156. -- Report to admin (if logged in).
  157. function ac.report_suspicious_act(pname, pos, act)
  158. local pref = minetest.get_player_by_name(ac.admin_name)
  159. if pref then
  160. minetest.chat_send_player(ac.admin_name,
  161. "# Server: <" .. rename.gpn(pname) ..
  162. "> caught in suspicious activity: '" .. act .. "' at " ..
  163. rc.pos_to_namestr(pos) .. ". Suspicion: " ..
  164. ac.get_suspicion_count(pname) .. ".")
  165. end
  166. end
  167. function ac.record_player_position(pname, pos)
  168. local pdata = ac.players[pname]
  169. if not pdata then
  170. ac.players[pname] = {}
  171. pdata = ac.players[pname]
  172. end
  173. -- This is for recording the position of the player when they were last
  174. -- checked by the standard check function. Thus, if the standard check func
  175. -- detects a possible cheat, following sub-checks that get spawned via
  176. -- minetest.after() can refer back to the player's position at the first
  177. -- check.
  178. pdata.last_pos = pos
  179. end
  180. -- This function is the main "brain" of the AC logic (for fly cheaters).
  181. -- It must be as accurate as possible for a given position! Note: second
  182. -- argument is nil unless checking prior path.
  183. function ac.is_flying(pos, data)
  184. -- We assume that the input position is rounded to nearest integer.
  185. local under = vector.add(pos, {x=0, y=-1, z=0})
  186. local node = minetest.get_node(under).name
  187. -- If we're checking prior path, then choose the OLD node-name for the foot
  188. -- node position. This should be the name of the node at that location at the
  189. -- time the record was made. We need to use this OLD name, instead of the most
  190. -- recent map information, because player could have dug their supports out
  191. -- (e.g., ladders or scaffolding)!
  192. if data then
  193. node = data.snode or ""
  194. end
  195. -- If non-air below this position, then player is probably not flying.
  196. if node ~= "air" then return false end
  197. -- Check up to 2 meters below player, and 1 meter all around.
  198. -- Fly cheaters tend to be pretty blatent in their cheating,
  199. -- and I want to avoid logging players who do a lot of jumping.
  200. local minp = {x=pos.x-1, y=pos.y-2, z=pos.z-1}
  201. local maxp = {x=pos.x+1, y=pos.y+0, z=pos.z+1}
  202. local tb = minetest.find_nodes_in_area(minp, maxp, "air")
  203. if #tb >= 27 then
  204. -- If all nodes under player are air, then player is not supported.
  205. -- However, they could be jumping with help of a bouncer.
  206. -- Note: trampolines do not throw player high enough to be a concern.
  207. local p = vector_round(pos)
  208. local z = p.y
  209. local d = p.y - 30
  210. local get_node = minetest.get_node
  211. for y = z, d, -1 do
  212. p.y = y
  213. local n = get_node(p).name
  214. if n:find("^jumping:") then
  215. -- Bouncer underneath. Not flying.
  216. return false
  217. elseif n ~= "air" and n ~= "ignore" then
  218. -- We have found a node that isn't a bouncer.
  219. -- If this node is walkable then we found the ground.
  220. local ndef = minetest.registered_nodes[n] or {}
  221. if ndef.walkable then
  222. -- Found walkable node. Probably the ground.
  223. return true
  224. end
  225. end
  226. end
  227. -- Could most likely be flying.
  228. return true
  229. end
  230. -- Not flying.
  231. return false
  232. end
  233. local is_solid_dt = function(dt)
  234. if dt == "normal" then
  235. return true
  236. elseif dt == "glasslike" then
  237. return true
  238. elseif dt == "glasslike_framed" then
  239. return true
  240. elseif dt == "glasslike_framed_optional" then
  241. return true
  242. elseif dt == "allfaces" then
  243. return true
  244. elseif dt == "allfaces_optional" then
  245. return true
  246. end
  247. end
  248. -- This function is the main "brain" of the AC logic (for noclip cheaters).
  249. -- It must be as accurate as possible for a given position! Note: second
  250. -- argument is nil unless checking prior path.
  251. function ac.is_clipping(pos, data)
  252. -- We assume that the input position is rounded to nearest integer.
  253. local under = vector.add(pos, {x=0, y=-1, z=0})
  254. local above = vector.add(pos, {x=0, y=1, z=0})
  255. local n1 = minetest.get_node(under).name
  256. local n2 = minetest.get_node(pos).name
  257. local n3 = minetest.get_node(above).name
  258. -- If we're checking prior path, then choose the OLD node-name for the middle
  259. -- node position. This should be the name of the node at that location at the
  260. -- time the record was made. We need to use this OLD name, instead of the most
  261. -- recent map information, because player could have placed blocks on top of
  262. -- their trail (e.g., when building tall walls)!
  263. if data then
  264. n2 = data.wnode or ""
  265. end
  266. if n1 ~= "air" and n2 ~= "air" and n3 ~= "air" then
  267. local d1 = minetest.reg_ns_nodes[n1]
  268. local d2 = minetest.reg_ns_nodes[n2]
  269. local d3 = minetest.reg_ns_nodes[n3]
  270. -- One of the nodes is a stairsplus node, or similar.
  271. if not d1 or not d2 or not d3 then
  272. return false
  273. end
  274. -- Check if all three nodes are solid, walkable nodes.
  275. if d1.walkable and d2.walkable and d3.walkable then
  276. local d1d = d1.drawtype
  277. local d2d = d2.drawtype
  278. local d3d = d3.drawtype
  279. if is_solid_dt(d1d) and is_solid_dt(d2d) and is_solid_dt(d3d) then
  280. return true
  281. end
  282. end
  283. end
  284. -- Not clipping.
  285. return false
  286. end
  287. function ac.check_prior_position(pname, data, act)
  288. local pos = vector_round(data.pos)
  289. local time = data.time
  290. local cheat = false
  291. if act == "fly" then
  292. if ac.is_flying(pos, data) then cheat = true end
  293. elseif act == "clip" then
  294. if ac.is_clipping(pos, data) then cheat = true end
  295. end
  296. if cheat then
  297. ac.record_suspicious_act(pname, nil, act) -- Record in current session memory.
  298. ac.report_suspicious_act(pname, pos, act) -- Report to admin (if logged in).
  299. ac.log_suspicious_act(pname, pos, time, act) -- Log to file.
  300. end
  301. end
  302. function ac.check_prior_path(pname, act)
  303. -- Get prior known locations for this player.
  304. -- Locations should be provided in order, with timestamps.
  305. local path = ap.get_position_list(pname)
  306. -- Spread checking of the path out over a few seconds.
  307. for i=1, #path, 1 do
  308. local data = path[i]
  309. -- Get fractional random number between 1 and 10.
  310. local delay = (math_random(1, 300) / 30)
  311. minetest.after(delay, ac.check_prior_position, pname, data, act)
  312. end
  313. end
  314. function ac.confirm_flying(pname, last_pos)
  315. -- Check if player still logged on.
  316. -- This function is designed to be called from minetest.after right after an
  317. -- initial trigger of suspicion, to try and confirm it.
  318. local pref = minetest.get_player_by_name(pname)
  319. if pref then
  320. local pos = vector_round(pref:get_pos())
  321. -- If player is falling at least somewhat quickly, then they aren't flying.
  322. if pos.y < (last_pos.y - 1) then return end
  323. -- If player stopped flying, then it might have been a false-positive.
  324. if not ac.is_flying(pos) then return end
  325. local time = os.time()
  326. local prevtime = ac.get_last_cheat_time(pname)
  327. -- If we reach here then the player is still flying!
  328. ac.record_suspicious_act(pname, time, "fly") -- Record in current session memory.
  329. ac.report_suspicious_act(pname, pos, "fly") -- Report to admin (if logged in).
  330. ac.log_suspicious_act(pname, pos, time, "fly") -- Log to file.
  331. -- Register as confirmed cheater if suspicion for this session exceeds threshold.
  332. local ts = ac.get_suspicion_count(pname)
  333. if ts > ac.cheat_registration_threshold then
  334. if not sheriff.is_cheater(pname) then
  335. sheriff.register_cheater(pname)
  336. end
  337. end
  338. -- Check the player's prior path if we haven't done so recently.
  339. if (time - prevtime) > ap.get_record_time() then
  340. ac.check_prior_path(pname, "fly")
  341. end
  342. end
  343. end
  344. function ac.confirm_clipping(pname, last_pos)
  345. -- Check if player still logged on.
  346. -- This function is designed to be called from minetest.after right after an
  347. -- initial trigger of suspicion, to try and confirm it.
  348. local pref = minetest.get_player_by_name(pname)
  349. if pref then
  350. local pos = vector_round(pref:get_pos())
  351. -- If player stopped clipping, then it might have been a false-positive.
  352. if not ac.is_clipping(pos) then return end
  353. local time = os.time()
  354. local prevtime = ac.get_last_cheat_time(pname)
  355. -- If we reach here then the player is still clipping!
  356. ac.record_suspicious_act(pname, time, "clip") -- Record in current session memory.
  357. ac.report_suspicious_act(pname, pos, "clip") -- Report to admin (if logged in).
  358. ac.log_suspicious_act(pname, pos, time, "clip") -- Log to file.
  359. -- Register as confirmed cheater if suspicion for this session exceeds threshold.
  360. local ts = ac.get_suspicion_count(pname)
  361. if ts > ac.cheat_registration_threshold then
  362. if not sheriff.is_cheater(pname) then
  363. sheriff.register_cheater(pname)
  364. end
  365. end
  366. -- Check the player's prior path if we haven't done so recently.
  367. if (time - prevtime) > ap.get_record_time() then
  368. ac.check_prior_path(pname, "clip")
  369. end
  370. end
  371. end
  372. function ac.do_standard_check(pname, pref)
  373. --minetest.chat_send_player(pname, "# Server: Check player!")
  374. local pos = vector_round(pref:get_pos())
  375. if ac.is_flying(pos) then
  376. -- Check again in a moment.
  377. local delay = math_random(1, 3)
  378. minetest.after(delay, ac.confirm_flying, pname, pos)
  379. end
  380. if ac.is_clipping(pos) then
  381. -- Check again in a moment.
  382. local delay = math_random(1, 3)
  383. minetest.after(delay, ac.confirm_clipping, pname, pos)
  384. end
  385. end
  386. function ac.nearby_player_count(pname, pref)
  387. local p1 = pref:get_pos()
  388. local players = minetest.get_connected_players()
  389. local count = 0
  390. for k, v in ipairs(players) do
  391. if v:get_player_name() ~= pname then
  392. local p2 = v:get_pos()
  393. if vector_distance(p1, p2) < 75 then
  394. count = count + 1
  395. end
  396. end
  397. end
  398. return count
  399. end
  400. function ac.check_player(pname)
  401. -- If this player is already a registered cheater, don't bother checking them
  402. -- for further cheats. Unless such checks ought to trigger immediate punishments
  403. -- when failed, it's probably a waste of resources.
  404. if sheriff.is_cheater(pname) then
  405. return
  406. end
  407. -- Check if player still logged in.
  408. local pref = minetest.get_player_by_name(pname)
  409. if pref then
  410. local pp = pref:get_pos()
  411. -- Don't bother performing checks for dead players.
  412. if pref:get_hp() > 0 then
  413. -- Don't check players attached to entities.
  414. if not default.player_attached[pname] then
  415. local op = ac.get_position_at_last_check_or_nil(pname)
  416. -- Don't bother checking player if they haven't moved.
  417. if not op or vector_distance(pp, op) > 1 then
  418. -- Don't check players in the Outback.
  419. if rc.current_realm_at_pos(pp) ~= "abyss" then
  420. ac.record_player_position(pname, pp)
  421. ac.do_standard_check(pname, pref)
  422. end
  423. end
  424. end
  425. end
  426. -- Check this player again after some delay.
  427. -- Reduce time to next check if player has some suspicion on them.
  428. local delay = math_random(ac.default_delay_min, ac.default_delay_max)
  429. delay = delay - ac.get_suspicion_count(pname)
  430. if city_block:in_city(pp) then
  431. -- Decrease time to next check if the position is within the city.
  432. delay = delay - math_random(ac.city_reduce_min, ac.city_reduce_max)
  433. elseif not city_block:in_no_leecher_zone(pp) then
  434. -- Increase time to next check if the position is in the outlands.
  435. delay = delay + math_random(ac.outland_increase_min, ac.outland_increase_max)
  436. end
  437. -- Increase time between standard checks if many players are logged in.
  438. local players = minetest.get_connected_players()
  439. delay = delay + ((#players) - 1) * 4
  440. -- Increase time to next standard check if player has little recorded
  441. -- suspicion generated from prior sessions. Decrease time to next check if
  442. -- player's average suspicion levels seem to be high.
  443. local total_suspicion = ac.get_total_suspicion(pname)
  444. local clean_sessions = ac.get_clean_sessions(pname)
  445. if clean_sessions < 1 then clean_sessions = 1 end
  446. local avg_suspicion = total_suspicion / clean_sessions
  447. if avg_suspicion < ac.low_average_suspicion then
  448. delay = delay + math_random(ac.low_suspicion_increase_min, ac.low_suspicion_increase_max)
  449. elseif avg_suspicion > ac.high_average_suspicion then
  450. delay = delay - math_random(ac.high_suspicion_reduce_min, ac.high_suspicion_reduce_max)
  451. end
  452. -- Reduce time to next check if player is near others.
  453. local others = ac.nearby_player_count(pname, pref)
  454. if others > 0 then
  455. delay = delay - math_random(0, others * 10)
  456. end
  457. -- Schedule check not less than 1 second future.
  458. if delay < 1 then delay = 1 end
  459. minetest.after(delay, ac.check_player, pname)
  460. end
  461. end
  462. function ac.on_joinplayer(pref)
  463. local pname = pref:get_player_name()
  464. -- Do not perform AC checks for admin player.
  465. if gdac.player_is_admin(pname) then return end
  466. local delay = math_random(ac.initial_delay_min, ac.initial_delay_max)
  467. -- Reduce time to next check if they have some suspicion on them.
  468. delay = delay - ac.get_suspicion_count(pname)
  469. if delay < 1 then delay = 1 end
  470. -- Schedule check.
  471. minetest.after(delay, ac.check_player, pname)
  472. end
  473. function ac.erase_statistics(pname)
  474. local k1 = pname .. ":dirty_sessions"
  475. local k2 = pname .. ":last_session_dirty"
  476. local k3 = pname .. ":total_suspicion"
  477. local k4 = pname .. ":clean_sessions"
  478. ac.storage:set_int(k1, 0)
  479. ac.storage:set_int(k2, 0)
  480. ac.storage:set_int(k3, 0)
  481. ac.storage:set_int(k4, 0)
  482. ac.players[pname] = nil
  483. end
  484. function ac.on_shutdown()
  485. -- On session shutdown (usually nightly) record overall clean/dirty status for
  486. -- registered players.
  487. for pname, pdata in pairs(ac.players) do
  488. if passport.player_registered(pname) then
  489. local suspicion = ac.get_suspicion_count(pname)
  490. if suspicion == 0 then
  491. local k1 = pname .. ":clean_sessions"
  492. local k2 = pname .. ":last_session_dirty"
  493. local cc = ac.storage:get_int(k1)
  494. cc = cc + 1
  495. ac.storage:set_int(k1, cc)
  496. ac.storage:set_int(k2, 0) -- The last session (this one) was clean.
  497. else
  498. local k1 = pname .. ":dirty_sessions"
  499. local k2 = pname .. ":last_session_dirty"
  500. local k3 = pname .. ":total_suspicion"
  501. local dd = ac.storage:get_int(k1)
  502. dd = dd + 1
  503. ac.storage:set_int(k1, dd)
  504. ac.storage:set_int(k2, 1) -- The last session (this one) was dirty.
  505. -- Add suspicion count from this session to the permanent total for this
  506. -- player.
  507. local ts = ac.storage:get_int(k3)
  508. ts = ts + ac.get_suspicion_count(pname)
  509. ac.storage:set_int(k3, ts)
  510. end
  511. end
  512. end
  513. end
  514. function ac.show_path(user, target)
  515. local path = ap.get_position_list(target)
  516. if not path or #path == 0 then
  517. return
  518. end
  519. local lpath = #path
  520. for k = 1, lpath, 1 do
  521. local data = path[k]
  522. local pos = data.pos
  523. utility.original_add_particle({
  524. playername = user,
  525. pos = pos,
  526. velocity = {x=0, y=0, z=0},
  527. acceleration = {x=0, y=0, z=0},
  528. expirationtime = 60,
  529. size = 4,
  530. collisiondetection = false,
  531. vertical = false,
  532. texture = "heart.png",
  533. glow = 14,
  534. })
  535. end
  536. end
  537. if not ac.registered then
  538. minetest.register_on_joinplayer(function(...)
  539. ac.on_joinplayer(...)
  540. end)
  541. minetest.register_on_shutdown(function(...)
  542. ac.on_shutdown(...)
  543. end)
  544. minetest.register_chatcommand("show-path", {
  545. params = "<player>",
  546. description = "Show user path.",
  547. privs = {server=true},
  548. func = function(pname, param)
  549. ac.show_path(pname, param)
  550. end,
  551. })
  552. local c = "ac:core"
  553. local f = ac.modpath .. "/init.lua"
  554. reload.register_file(c, f, false)
  555. ac.registered = true
  556. end