Skip to content

Commit db01031

Browse files
committed
chore: fix qlty config a bit
1 parent ab2832e commit db01031

File tree

13 files changed

+289
-286
lines changed

13 files changed

+289
-286
lines changed

.qlty/configs/.yamllint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ rules:
22
document-start: disable
33
quoted-strings:
44
required: only-when-needed
5-
extra-allowed: ["{|}"]
5+
extra-allowed: ['{|}']
66
key-duplicates: {}
77
octal-values:
88
forbid-implicit-octal: true

.qlty/qlty.toml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ exclude_patterns = [
4444
"tools/**",
4545
"*.config.ts",
4646
"src/modules/world-edit/**",
47+
"src/lib/utils/sprintf.ts",
48+
"src/lib/utils/later.ts",
49+
"src/lib/vector.ts",
4750
"items/**",
4851
"*.json",
4952
"functions/**",
@@ -65,19 +68,20 @@ test_patterns = [
6568

6669
[smells]
6770
mode = "comment"
68-
69-
[smells.return_statements]
70-
enabled = false
71+
return_statements.enabled = false
72+
function_parameters.threshold = 10
73+
function_complexity.threshold = 40
74+
file_complexity.threshold = 100
7175

7276
[[source]]
7377
name = "default"
7478
default = true
7579

76-
[[plugin]]
77-
name = "osv-scanner"
80+
# [[plugin]]
81+
# name = "osv-scanner"
7882

79-
[[plugin]]
80-
name = "radarlint-js"
83+
# [[plugin]]
84+
# name = "radarlint-js"
8185

8286
[[plugin]]
8387
name = "ripgrep"

src/lib/chunk-query.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,4 +565,3 @@ function inspectChunks(query: ChunkQuery, dimensionType: DimensionType = 'overwo
565565
return 'Empty'
566566
}
567567
}
568-

src/lib/region/areas/cut.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,3 @@ describe('sphere', () => {
248248
expect(vOrder).toEqual(otherVOrder)
249249
})
250250
})
251-

src/lib/region/areas/sphere.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,3 @@ describe('sphere', () => {
176176
expect(vOrder).toEqual(otherVOrder)
177177
})
178178
})
179-

src/lib/region/structure.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export class RegionStructure {
3636

3737
save(): void | Promise<void> {
3838
this.validateArea()
39-
// TODO Test that changin order of edges does not break structure
4039
world.structureManager.createFromWorld(this.id, this.region.dimension, ...this.region.area.edges, {
4140
saveMode: StructureSaveMode.World,
4241
includeEntities: false,

src/lib/rpg/loot-table.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,3 @@ describe('loot table random cost', () => {
6363
`)
6464
})
6565
})
66-

src/modules/commands/player.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// TODO Group actions (e.g. mute, ban, invsee, wpchest etc)
2-
31
import { Player } from '@minecraft/server'
42
import { is, Portal, stringify } from 'lib'
53
import { Achievement } from 'lib/achievements/achievement'

src/modules/places/anarchy/quartz.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ItemStack, system } from '@minecraft/server'
22

33
import { MinecraftBlockTypes, MinecraftEffectTypes, MinecraftItemTypes } from '@minecraft/vanilla-data'
44
import { isKeyof, ms } from 'lib'
5+
import { RegionEvents } from 'lib/region/events'
56
import { actionGuard, ActionGuardOrder, disableAdventureNear, Region, RegionPermissions } from 'lib/region/index'
67
import { ScheduleBlockPlace } from 'lib/scheduled-block-place'
78
import { TechCity } from '../tech-city/tech-city'
@@ -42,29 +43,28 @@ system.runPlayerInterval(
4243
player => {
4344
const { typeId } = player.mainhand()
4445

45-
// TODO Maybe check for region or inv type
4646
if (typeId && isKeyof(typeId, HoeEffectLevels)) {
47-
player.addEffect(MinecraftEffectTypes.Haste, 2, {
48-
amplifier: HoeEffectLevels[typeId],
49-
showParticles: false,
50-
})
47+
const inQuartzMine = RegionEvents.playerInRegionsCache
48+
.get(player)
49+
?.some(e => e === TechCity.safeArea || e instanceof QuartzMineRegion)
50+
51+
if (inQuartzMine) {
52+
player.addEffect(MinecraftEffectTypes.Haste, 2, {
53+
amplifier: HoeEffectLevels[typeId],
54+
showParticles: false,
55+
})
56+
}
5157
}
5258
},
5359
'quartz feature, hoe haste effect',
5460
2,
5561
)
5662

57-
actionGuard((player, region, ctx) => {
58-
if (
59-
ctx.type !== 'break' ||
60-
(region !== TechCity.safeArea && !(region instanceof QuartzMineRegion)) ||
61-
// Check block
62-
ctx.event.block.typeId !== quartzTypeId ||
63-
// Check item
64-
!ctx.event.itemStack?.typeId ||
65-
!(ctx.event.itemStack.typeId in HoeEffectLevels)
66-
)
67-
return
63+
actionGuard((_, region, ctx) => {
64+
if (ctx.type !== 'break') return
65+
if (region !== TechCity.safeArea && !(region instanceof QuartzMineRegion)) return
66+
if (ctx.event.block.typeId !== quartzTypeId) return
67+
if (!ctx.event.itemStack?.typeId || !(ctx.event.itemStack.typeId in HoeEffectLevels)) return
6868

6969
ScheduleBlockPlace.setBlock(ctx.event.block, ms.from('min', 2))
7070

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { ItemStack } from '@minecraft/server'
2-
import { MinecraftItemTypes as i } from '@minecraft/vanilla-data'
2+
import {
3+
MinecraftPotionEffectTypes as e,
4+
MinecraftItemTypes as i,
5+
MinecraftPotionLiquidTypes as lt,
6+
MinecraftPotionModifierTypes as mt,
7+
} from '@minecraft/vanilla-data'
38
import { Group } from 'lib/rpg/place'
49
import { MoneyCost } from 'lib/shop/cost'
510
import { ShopNpc } from 'lib/shop/npc'
@@ -13,26 +18,42 @@ export class Barman extends ShopNpc {
1318
form.itemStack(new ItemStack(i.MilkBucket), new MoneyCost(10))
1419
form.itemStack(new ItemStack(i.HoneyBottle), new MoneyCost(20))
1520

16-
const pivo = new ItemStack(i.GlassBottle)
17-
pivo.nameTag = 'Пиво'
18-
form.itemStack(pivo, new MoneyCost(1))
21+
form.itemStack(
22+
ItemStack.createPotion({ effect: e.FireResistance, liquid: lt.Lingering }).setInfo('Квас', undefined),
23+
new MoneyCost(40),
24+
)
1925

20-
const kvac = new ItemStack(i.GlassBottle)
21-
kvac.nameTag = 'Квас'
22-
form.itemStack(kvac, new MoneyCost(1))
26+
form.itemStack(
27+
ItemStack.createPotion({ effect: e.FireResistance, liquid: lt.Lingering, modifier: mt.Long }).setInfo(
28+
'Пиво',
29+
undefined,
30+
),
31+
new MoneyCost(50),
32+
)
2333

24-
const sidr = new ItemStack(i.GlassBottle)
25-
sidr.nameTag = 'Сидр'
26-
form.itemStack(sidr, new MoneyCost(1))
34+
form.itemStack(
35+
ItemStack.createPotion({ effect: e.Invisibility, liquid: lt.Lingering, modifier: mt.Long }).setInfo(
36+
'Сидр',
37+
undefined,
38+
),
39+
new MoneyCost(500),
40+
)
2741

28-
const sh = new ItemStack(i.GlassBottle)
29-
sh.nameTag = 'Настойка из шпината'
30-
form.itemStack(sh, new MoneyCost(1))
42+
form.itemStack(
43+
ItemStack.createPotion({ effect: e.WaterBreath, liquid: lt.Lingering, modifier: mt.Long }).setInfo(
44+
'Настойка из шпината',
45+
undefined,
46+
),
47+
new MoneyCost(300),
48+
)
3149

32-
const wine = new ItemStack(i.GlassBottle)
33-
wine.nameTag = 'Вино'
34-
form.itemStack(wine, new MoneyCost(1))
35-
// TODO On potion API expansion add WINE
50+
form.itemStack(
51+
ItemStack.createPotion({ effect: e.TurtleMaster, liquid: lt.Lingering, modifier: mt.Long }).setInfo(
52+
'Вино',
53+
undefined,
54+
),
55+
new MoneyCost(1000),
56+
)
3657
})
3758
}
3859
}

0 commit comments

Comments
 (0)