phase shifts, itemize
This commit is contained in:
@ -8,6 +8,11 @@ const MobComponent = "mob"
|
||||
const MoveableComponent = "movable"
|
||||
const CarriedComponent = "carried"
|
||||
const UsableComponent = "usable"
|
||||
const WearableComponent = "usable"
|
||||
const ArmsComponent = "arms"
|
||||
const RangedComponent = "ranged"
|
||||
const AmmoComponent = "ammo"
|
||||
const ArmorComponent = "armor"
|
||||
|
||||
type Component interface {
|
||||
Type() string
|
||||
|
@ -21,7 +21,7 @@ type PrefabRecord struct {
|
||||
Size struct {
|
||||
X int `json:"x"`
|
||||
Y int `json:"y"`
|
||||
} `json:"Size"`
|
||||
} `json:"Bulk"`
|
||||
TileLegend map[string]string `json:"tile_legend"`
|
||||
MobsLegend map[string]string `json:"mobs_legend"`
|
||||
ItemLegend map[string]string `json:"item_legend"`
|
||||
|
14
engine/items/ammo.go
Normal file
14
engine/items/ammo.go
Normal file
@ -0,0 +1,14 @@
|
||||
package items
|
||||
|
||||
import (
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/ecs"
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/items/itemprops"
|
||||
)
|
||||
|
||||
type Ammo struct {
|
||||
itemprops.DamageProfile
|
||||
}
|
||||
|
||||
func (a *Ammo) Type() string {
|
||||
return ecs.AmmoComponent
|
||||
}
|
11
engine/items/armor.go
Normal file
11
engine/items/armor.go
Normal file
@ -0,0 +1,11 @@
|
||||
package items
|
||||
|
||||
import "lab.zaar.be/thefish/alchemyst-go/engine/ecs"
|
||||
|
||||
type Armor struct {
|
||||
DefenceProfile struct{}
|
||||
}
|
||||
|
||||
func (a *Armor) Type() string {
|
||||
return ecs.ArmorComponent
|
||||
}
|
14
engine/items/arms.go
Normal file
14
engine/items/arms.go
Normal file
@ -0,0 +1,14 @@
|
||||
package items
|
||||
|
||||
import (
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/ecs"
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/items/itemprops"
|
||||
)
|
||||
|
||||
type Arms struct {
|
||||
itemprops.DamageProfile
|
||||
}
|
||||
|
||||
func (a Arms) Type() string {
|
||||
return ecs.ArmsComponent
|
||||
}
|
@ -2,8 +2,26 @@ package items
|
||||
|
||||
import "lab.zaar.be/thefish/alchemyst-go/engine/ecs"
|
||||
|
||||
type Carried struct {}
|
||||
type CarriedFace interface {
|
||||
Drop()
|
||||
Pickup()
|
||||
}
|
||||
|
||||
type Carried struct {
|
||||
Mass int //масса в граммах
|
||||
Bulk int //внешний размер, см3
|
||||
}
|
||||
|
||||
func (c *Carried) Type() string {
|
||||
return ecs.CarriedComponent
|
||||
}
|
||||
|
||||
func (c *Carried) Pickup() {}
|
||||
func (c *Carried) Drop() {}
|
||||
|
||||
func (c *Carried) GetMass() int {
|
||||
return c.Mass
|
||||
}
|
||||
func (c *Carried) GetBulk() int {
|
||||
return c.Bulk
|
||||
}
|
7
engine/items/itemprops/damage.go
Normal file
7
engine/items/itemprops/damage.go
Normal file
@ -0,0 +1,7 @@
|
||||
package itemprops
|
||||
|
||||
type DamageProfile struct {
|
||||
Pierce int
|
||||
Bash int
|
||||
Cleave int
|
||||
}
|
11
engine/items/ranged.go
Normal file
11
engine/items/ranged.go
Normal file
@ -0,0 +1,11 @@
|
||||
package items
|
||||
|
||||
import "lab.zaar.be/thefish/alchemyst-go/engine/ecs"
|
||||
|
||||
type Ranged struct {
|
||||
RangeProfile struct{} //это зависимость дальности-скорости от характеристик и атрибутов
|
||||
}
|
||||
|
||||
func (r *Ranged) Type() string {
|
||||
return ecs.RangedComponent
|
||||
}
|
@ -2,9 +2,16 @@ package items
|
||||
|
||||
import "lab.zaar.be/thefish/alchemyst-go/engine/ecs"
|
||||
|
||||
type Useable struct {}
|
||||
type UsableFace interface {
|
||||
Use()
|
||||
}
|
||||
|
||||
type Usable struct {}
|
||||
|
||||
|
||||
func (u *Useable) Type() string {
|
||||
func (u *Usable) Type() string {
|
||||
return ecs.UsableComponent
|
||||
}
|
||||
|
||||
func (u *Usable) Use() {
|
||||
}
|
16
engine/items/wearable.go
Normal file
16
engine/items/wearable.go
Normal file
@ -0,0 +1,16 @@
|
||||
package items
|
||||
|
||||
import "lab.zaar.be/thefish/alchemyst-go/engine/ecs"
|
||||
|
||||
type WearableFace interface {
|
||||
Wear()
|
||||
Takeoff()
|
||||
}
|
||||
|
||||
type Wearable struct {
|
||||
Bodypart int //куда собстно одевать
|
||||
}
|
||||
|
||||
func (w *Wearable) Type() string {
|
||||
return ecs.WearableComponent
|
||||
}
|
82
engine/matertals/properties.go
Normal file
82
engine/matertals/properties.go
Normal file
@ -0,0 +1,82 @@
|
||||
package matertals
|
||||
|
||||
import "github.com/rs/zerolog/log"
|
||||
|
||||
type MaterialProperties struct {
|
||||
Density float64 //Плотность (кг / м3)
|
||||
Tougnness float64 //Ударная вязкость, мера скорости поглощения энергии без деформаций, джоули на квадратный метр в секунду
|
||||
Brittleness float64 //Хрупкость - обратная пластичности (в основном за счет внешних эффектов), джоули на квадртаный метр, после которых раскол
|
||||
MeltingPoint float64 //точка перехода из твердого в жидкое, градусы Цельсия при нормальном давлении
|
||||
BoilingPoint float64 //точка кипения - из жидкого в газ, градусы Цельсия при нормальном давлении
|
||||
Conductivity bool //проводимость эл. тока
|
||||
}
|
||||
|
||||
//агрегатное состояние
|
||||
type MatterState int
|
||||
|
||||
const (
|
||||
Solid MatterState = iota //кристаллическая решетка
|
||||
Liquid
|
||||
Gas
|
||||
Plasma
|
||||
|
||||
Glass //нет кристаллической решетки, аморфный
|
||||
)
|
||||
|
||||
var transitions = map[MatterState][]MatterState{
|
||||
Solid: {Liquid, Gas},
|
||||
Liquid: {Solid, Gas, Glass},
|
||||
Gas: {Solid, Plasma},
|
||||
Plasma: {Gas},
|
||||
|
||||
Glass: {Liquid},
|
||||
|
||||
}
|
||||
|
||||
func (ms MatterState) Change(from MatterState, to MatterState) bool {
|
||||
if from == to {
|
||||
return true
|
||||
}
|
||||
|
||||
_, ok := transitions[from]
|
||||
|
||||
if ok {
|
||||
newStateFound := func(lst []MatterState, to MatterState) bool {
|
||||
for _, b := range lst {
|
||||
if b == to {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}(transitions[from], to)
|
||||
if !newStateFound {
|
||||
log.Warn().Msgf("Transition %s -> %s is impossible", from, to)
|
||||
return false
|
||||
}
|
||||
// check temperatures/conditions, see template
|
||||
/*
|
||||
Solid -> Gas Sublimation
|
||||
Solid -> Liquid Melting
|
||||
|
||||
Liquid -> Gas Boiling
|
||||
Liquid -> Solid Freezing
|
||||
|
||||
Gas -> Solid Deposition
|
||||
Gas -> Liquid Condensation
|
||||
|
||||
Gas -> Plasma Ionization
|
||||
Plasma -> Gas Recombination
|
||||
*/
|
||||
}
|
||||
|
||||
//При фазовом переходе первого рода скачкообразно изменяются самые главные, первичные экстенсивные параметры:
|
||||
// удельный объём,
|
||||
// количество запасённой внутренней энергии,
|
||||
// концентрация компонентов и т. п.
|
||||
//
|
||||
// Фазовые переходы второго рода происходят в тех случаях, когда меняется симметрия строения вещества
|
||||
// (симметрия может полностью исчезнуть или понизиться).
|
||||
|
||||
return true
|
||||
|
||||
}
|
Reference in New Issue
Block a user