Skip to content

Commit 77049f9

Browse files
committed
fix: formatting of permdebug output
1 parent fcef63c commit 77049f9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/lib/region/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { i18n, noI18n } from 'lib/i18n/text'
1616
import { onPlayerMove } from 'lib/player-move'
1717
import { is } from 'lib/roles'
1818
import { isNotPlaying } from 'lib/utils/game'
19+
import { createLogger } from 'lib/utils/logger'
1920
import { AbstractPoint } from 'lib/utils/point'
2021
import { Vec } from 'lib/vector'
2122
import { EventSignal } from '../event-signal'
@@ -113,13 +114,19 @@ actionGuard((player, region, context) => {
113114
}
114115
}, ActionGuardOrder.ProjectileUsePrevent)
115116

117+
const permdebugLogger = createLogger('region-perm')
118+
116119
const allowed: InteractionAllowed = (player, region, context, regions) => {
117120
//
118121
for (const [fn] of EventSignal.sortSubscribers(ACTION_GUARD)) {
119122
const result = fn(player, region, context, regions)
120123
if (Region.permissionDebug) {
121-
if (is(player.id, 'techAdmin')) console.log('regionDebug', fn.toString().slice(0, 50), ' ', result)
122-
player.info(noI18n`regionDebug ${fn.toString().slice(0, 50).replaceAll('\n', ' ')} ${result}`)
124+
if (is(player.id, 'techAdmin')) {
125+
let msg = noI18n`§5${fn.toString().slice(0, 100).replaceAll('\n', ' ')} -> ${typeof result === 'undefined' ? '§bSKIP' : result}`
126+
if (typeof result === 'boolean') msg += noI18n`\n§fResult: ${result}`
127+
permdebugLogger.info(msg)
128+
player.tell(msg)
129+
}
123130
}
124131
if (typeof result === 'boolean') {
125132
return result

0 commit comments

Comments
 (0)