SciCraft/client_pack/kubejs/server_scripts/02_events.js
MiTHRAL 26a9fe775d
All checks were successful
Build & Release Pack / build (push) Successful in 1m46s
fix: KubeJS redeclaration of const SC across server scripts
Three server scripts each declared 'const SC' at top level, but KubeJS 2101
shares a single global scope across all server scripts → 'redeclaration of
const SC' TypeError.

Rename per-file to unique consts:
- 01_corruption_tide.js → const TIDE_SC
- 02_events.js          → const EVENTS_SC
- 03_recipes_tags.js    → const RECIPES_SC

(The IP warnings in the log — Iris portal artifacts + HAR 1010 wrong-mods —
are informational from the IPSable fork, not errors.)
2026-08-19 22:14:35 -04:00

48 lines
No EOL
1.6 KiB
JavaScript

// SCICRAFT — The Dark Photon Protocol
// Player-side lore events: the Resonance, void exposure, and held-item powers.
const EVENTS_SC = {
items: {
photon_core: 'scicraft:photon_core',
void_stabilizer: 'scicraft:void_stabilizer'
},
dimensions: {
void_dim: 'thevoiddimension:overworld',
darker_dim: 'deeperdarker:otherside'
}
}
// Proto-Time-Lord: holding a Photon Core or Stabilizer lets you feel the seals.
PlayerEvents.tick(event => {
if (event.player.server.ticks % 40 !== 0) return
const held = event.player.mainHandItem
if (held.id === EVENTS_SC.items.photon_core) {
event.player.potionEffects.add('minecraft:night_vision', 140, 0, true, false)
}
if (held.id === EVENTS_SC.items.void_stabilizer) {
event.player.potionEffects.add('minecraft:speed', 120, 0, true, false)
event.player.potionEffects.add('minecraft:regeneration', 120, 0, true, false)
}
})
// The wound is physically hostile. Being inside it costs you.
PlayerEvents.tick(event => {
const dim = String(event.player.level.dimension)
if (dim === EVENTS_SC.dimensions.void_dim) {
if (event.player.server.ticks % 100 === 0) {
event.player.hurt('minecraft:generic', 1.0)
}
} else if (dim === EVENTS_SC.dimensions.darker_dim) {
if (event.player.server.ticks % 200 === 0) {
event.player.potionEffects.add('minecraft:wither', 80, 0, true, false)
}
}
})
// Arrival in the wound triggers the first vision.
PlayerEvents.loggedIn(event => {
event.player.tell(Text.translate('scicraft.phrases.signal'))
})
// Note: Warden fragment drops are handled in 04_loot.js (LootJS) — do not
// duplicate them here or players get double drops.