Exemple #1
0
func init() {
	world.Register("forge", world.Visible((*Forge)(nil)))
	world.RegisterSpawnFunc(func(s string) world.Visible {
		if s == "forge" {
			return &Forge{}
		}
		return nil
	})
}
Exemple #2
0
func init() {
	world.Register("door", world.Visible((*Door)(nil)))
	world.RegisterSpawnFunc(func(s string) world.Visible {
		if s == "door" {
			return &Door{}
		}
		return nil
	})
}
Exemple #3
0
func init() {
	world.Register("wall", world.Visible((*Wall)(nil)))
	world.RegisterSpawnFunc(WrapSpawnFunc(func(material *Material, s string) world.Visible {
		if s == "wall" {
			return &Wall{
				material: material,
			}
		}
		return nil
	}))
}
Exemple #4
0
func init() {
	world.Register("floor", world.Visible((*Floor)(nil)))
	world.RegisterSpawnFunc(WrapSpawnFunc(func(material *Material, s string) world.Visible {
		if s == "floor" {
			return &Floor{
				material: material,
			}
		}
		return nil
	}))
}
Exemple #5
0
func init() {
	world.Register("hero", HeroLike((*Hero)(nil)))

	world.RegisterSpawnFunc(func(s string) world.Visible {
		for i := range raceInfo {
			r := Race(i)
			if r.Name() == s {
				return GenerateHeroRace(rand.New(rand.NewSource(rand.Int63())), r)
			}
		}
		return nil
	})
}
Exemple #6
0
func init() {
	world.Register("ingot", world.Visible((*Ingot)(nil)))

	world.RegisterSpawnFunc(WrapSpawnFunc(func(material *Material, s string) world.Visible {
		wood, stone, metal := material.Get()
		if len(wood) != 0 || len(stone) != 0 || len(metal) == 0 {
			return nil
		}
		if s == "ingot" {
			return &Ingot{
				material: material,
			}
		}
		return nil
	}))
}
Exemple #7
0
func init() {
	world.Register("equip", world.Visible((*Equip)(nil)))

	world.RegisterSpawnFunc(material.WrapSpawnFunc(func(mat *material.Material, s string) world.Visible {
		wood, stone, metal := mat.Get()
		for t := range equippables {
			for i, e := range equippables[t] {
				if e.name == s {
					haveWood := false
					haveStone := false
					haveMetal := false
					for _, c := range e.colors {
						if c == woodColor {
							haveWood = true
						}
						if c == stoneColor {
							haveStone = true
						}
						if c == metalColor {
							haveMetal = true
						}
					}
					if !haveWood && len(wood) != 0 {
						continue
					}
					if !haveStone && len(stone) != 0 {
						continue
					}
					if !haveMetal && len(metal) != 0 {
						continue
					}
					return &Equip{
						slot:      EquipSlot(t),
						kind:      uint64(i),
						materials: []*material.Material{mat},
					}
				}
			}
		}
		return nil
	}))
}
Exemple #8
0
func init() {
	world.Register("critter", world.Combat((*Critter)(nil)))

	world.RegisterSpawnFunc(func(s string) world.Visible {
		living, s := world.SpawnModules(s)

		for t := CritterType(0); t < critterTypeCount; t++ {
			if s == t.Name() {
				return &Critter{
					CombatObject: world.CombatObject{
						LivingObject: living,
					},
					kind:   t,
					colors: t.GenerateColors(),
				}
			}
		}
		return nil
	})
}
Exemple #9
0
func init() {
	world.Register("stone", world.Visible((*Stone)(nil)))
}
Exemple #10
0
func init() {
	world.Register("tree", NodeLike((*Tree)(nil)))
}
Exemple #11
0
func init() {
	world.Register("logs", world.Visible((*Logs)(nil)))
}
Exemple #12
0
func init() {
	world.Register("player", HeroLike((*Player)(nil)))
}
Exemple #13
0
func init() {
	world.Register("playerinst", world.ObjectLike((*PlayerInstance)(nil)))
}
Exemple #14
0
func init() {
	world.Register("ancestry", world.ObjectLike((*PlayerAncestry)(nil)))
}
Exemple #15
0
func init() {
	world.Register("rock", NodeLike((*Rock)(nil)))
}
Exemple #16
0
func init() {
	world.Register("ore", world.Visible((*Ore)(nil)))
}
Exemple #17
0
func init() {
	world.Register("slime", world.Visible((*Slime)(nil)))
}
Exemple #18
0
func init() {
	world.Register("mat", world.ObjectLike((*Material)(nil)))
}
Exemple #19
0
func init() {
	world.Register("resnode", NodeLike((*Node)(nil)))
}