Пример #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
	})
}
Пример #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
	})
}
Пример #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
	}))
}
Пример #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
	}))
}
Пример #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
	})
}
Пример #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
	}))
}
Пример #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
	}))
}
Пример #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
	})
}
Пример #9
0
func init() {
	world.Register("stone", world.Visible((*Stone)(nil)))
}
Пример #10
0
func init() {
	world.Register("tree", NodeLike((*Tree)(nil)))
}
Пример #11
0
func init() {
	world.Register("logs", world.Visible((*Logs)(nil)))
}
Пример #12
0
func init() {
	world.Register("player", HeroLike((*Player)(nil)))
}
Пример #13
0
func init() {
	world.Register("playerinst", world.ObjectLike((*PlayerInstance)(nil)))
}
Пример #14
0
func init() {
	world.Register("ancestry", world.ObjectLike((*PlayerAncestry)(nil)))
}
Пример #15
0
func init() {
	world.Register("rock", NodeLike((*Rock)(nil)))
}
Пример #16
0
func init() {
	world.Register("ore", world.Visible((*Ore)(nil)))
}
Пример #17
0
func init() {
	world.Register("slime", world.Visible((*Slime)(nil)))
}
Пример #18
0
func init() {
	world.Register("mat", world.ObjectLike((*Material)(nil)))
}
Пример #19
0
func init() {
	world.Register("resnode", NodeLike((*Node)(nil)))
}