45 lines
No EOL
1.5 KiB
JavaScript
45 lines
No EOL
1.5 KiB
JavaScript
// SCICRAFT — The Dark Photon Protocol
|
|
// Player-side lore events: the Resonance, void exposure, and held-item powers.
|
|
|
|
const SC = global.SCICRAFT
|
|
|
|
// 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 === SC.items.photon_core) {
|
|
event.player.potionEffects.add('minecraft:night_vision', 140, 0, true, false)
|
|
}
|
|
if (held.id === 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 === SC.dimensions.void_dim) {
|
|
if (event.player.server.ticks % 100 === 0) {
|
|
event.player.hurt('minecraft:generic', 1.0)
|
|
}
|
|
} else if (dim === 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'))
|
|
})
|
|
|
|
// The very first fragment always drops when a Darker falls — never lost.
|
|
EntityEvents.death(event => {
|
|
const ent = event.entity
|
|
if (ent.type === 'minecraft:warden') {
|
|
ent.level.spawnItem('scicraft:photon_fragment', ent.blockPosition(), { count: 2 })
|
|
}
|
|
}) |