Skip to content

server.effect

Constants #

const absorption = Type{
	id:      22
	name:    'absorption'
	lasting: true
}
const blindness = Type{
	id:      15
	name:    'blindness'
	lasting: true
}
const conduit_power = Type{
	id:      26
	name:    'conduit_power'
	lasting: true
}
const darkness = Type{
	id:      30
	name:    'darkness'
	lasting: true
}
const ticks_per_second = 20
const fatal_poison = Type{
	id:      25
	name:    'fatal_poison'
	lasting: true
}
const fire_resistance = Type{
	id:      12
	name:    'fire_resistance'
	lasting: true
}
const haste = Type{
	id:      3
	name:    'haste'
	lasting: true
}
const health_boost = Type{
	id:      21
	name:    'health_boost'
	lasting: true
}
const hunger = Type{
	id:      17
	name:    'hunger'
	lasting: true
}
const instant_damage = Type{
	id:   7
	name: 'instant_damage'
}
const instant_health = Type{
	id:   6
	name: 'instant_health'
}
const invisibility = Type{
	id:      14
	name:    'invisibility'
	lasting: true
}
const jump_boost = Type{
	id:      8
	name:    'jump_boost'
	lasting: true
}
const levitation = Type{
	id:      24
	name:    'levitation'
	lasting: true
}
const mining_fatigue = Type{
	id:      4
	name:    'mining_fatigue'
	lasting: true
}
const nausea = Type{
	id:      9
	name:    'nausea'
	lasting: true
}
const night_vision = Type{
	id:      16
	name:    'night_vision'
	lasting: true
}
const poison = Type{
	id:      19
	name:    'poison'
	lasting: true
}
const regeneration = Type{
	id:      10
	name:    'regeneration'
	lasting: true
}
const resistance = Type{
	id:      11
	name:    'resistance'
	lasting: true
}
const saturation = Type{
	id:   23
	name: 'saturation'
}
const slow_falling = Type{
	id:      27
	name:    'slow_falling'
	lasting: true
}
const slowness = Type{
	id:      2
	name:    'slowness'
	lasting: true
}
const speed = Type{
	id:      1
	name:    'speed'
	lasting: true
}
const strength = Type{
	id:      5
	name:    'strength'
	lasting: true
}
const water_breathing = Type{
	id:      13
	name:    'water_breathing'
	lasting: true
}
const weakness = Type{
	id:      18
	name:    'weakness'
	lasting: true
}
const wither = Type{
	id:      20
	name:    'wither'
	lasting: true
}

fn new #

fn new(typ Type, level int, duration time.Duration) Effect

fn new_ambient #

fn new_ambient(typ Type, level int, duration time.Duration) Effect

fn new_infinite #

fn new_infinite(typ Type, level int) Effect

fn new_instant #

fn new_instant(typ Type, level int) Effect

fn new_instant_with_potency #

fn new_instant_with_potency(typ Type, level int, potency f64) Effect

fn new_manager #

fn new_manager() Manager

struct AddResult #

struct AddResult {
pub:
	effect   Effect
	accepted bool
	stored   bool
	replaced bool
	previous Effect
}

struct Effect #

struct Effect {
mut:
	typ              Type
	level            int
	duration_ticks   int
	potency          f64 = 1.0
	ambient          bool
	particles_hidden bool
	infinite         bool
	instant          bool
	tick             int
}

fn (Effect) without_particles #

fn (e Effect) without_particles() Effect

fn (Effect) effect_type #

fn (e Effect) effect_type() Type

fn (Effect) level #

fn (e Effect) level() int

fn (Effect) duration #

fn (e Effect) duration() time.Duration

fn (Effect) duration_ticks #

fn (e Effect) duration_ticks() int

fn (Effect) potency #

fn (e Effect) potency() f64

fn (Effect) ambient #

fn (e Effect) ambient() bool

fn (Effect) particles_hidden #

fn (e Effect) particles_hidden() bool

fn (Effect) infinite #

fn (e Effect) infinite() bool

fn (Effect) instant #

fn (e Effect) instant() bool

fn (Effect) tick #

fn (e Effect) tick() int

struct Manager #

struct Manager {
mut:
	effects map[int]Effect
}

fn (Manager) add #

fn (mut m Manager) add(e Effect) Effect

fn (Manager) add_result #

fn (mut m Manager) add_result(e Effect) AddResult

fn (Manager) remove #

fn (mut m Manager) remove(typ Type) ?Effect

fn (Manager) effect #

fn (m &Manager) effect(typ Type) ?Effect

fn (Manager) effects #

fn (m &Manager) effects() []Effect

fn (Manager) tick #

fn (mut m Manager) tick() TickResult

struct TickResult #

struct TickResult {
pub:
	active  []Effect
	expired []Effect
}

struct Type #

struct Type {
pub:
	id      int
	name    string
	lasting bool
}