body & combat primitives wip

This commit is contained in:
thefish 2022-10-12 15:50:38 +03:00
parent bf13c9c7a2
commit 20ba03c758
9 changed files with 569 additions and 336 deletions

View File

@ -116,7 +116,7 @@ func main() {
//"[color=yellow]Note[/color]: Many of these are not implemented yet",
"[color=yellow]Note[/color]: Many of these are not implemented yet",
types.NewCenteredRect(mw.Rect, 50, 15),
true, ).
true).
SetBgColor("#ef1d494f").
SetFgColor("white").
SetItems([]interface{}{
@ -142,12 +142,13 @@ func main() {
//"[color=yellow]Note[/color]: Many of these are not implemented yet",
"",
types.NewCenteredRect(mw.Rect, 70, 25),
true, ).
true).
SetBgColor("#ef305c70").
SetFgColor("white"),
}
screenMgr.AddScreen("devmenu", screens.NewDevmenuScreen(
mainCtx,
mw,
controller,
screenMgr,
@ -207,7 +208,6 @@ func main() {
screenMgr.AddScreen("inventory", inv.MakeInverntory(player))
//but every call to bearlibterminal must be wrapped to closure and passed to mainfunc
var exit = false
for !exit {
@ -286,7 +286,7 @@ func decodeInput(ctx context.Context, baseLayer *mainwindow.Layer) {
return
default:
if pressed != "" {
waitForWCspam = false;
waitForWCspam = false
State.Input <- pressed
}
}

View File

@ -22,10 +22,10 @@ func TestDelaunay(t *testing.T) {
{types.Coords{30, 10}, types.Coords{40, 20}},
{types.Coords{60, 10}, types.Coords{40, 60}},
{types.Coords{40, 20}, types.Coords{40, 60}},
{types.Coords{10, 10,}, types.Coords{30, 10}},
{types.Coords{10, 10}, types.Coords{30, 10}},
}
result := delaunay.GetMst(coords, 100, 100)
result := delaunay.GetMst(coords, 100, 100, 0)
for idx, _ := range result {
if result[idx] != expected[idx] {

View File

@ -0,0 +1,21 @@
package itemprops
import "github.com/shopspring/decimal"
type ArmorProfile struct {
LayerExtra Armored
LayerOuter Armored
LayerMiddle Armored
LayerInner Armored
}
type Armored struct {
ItemPhysics
Coverage Coverage
}
//Coverage is set of partial coverage from 0 to 1 (0 to 100%)
type Coverage struct {
Frontal decimal.Decimal
Rear decimal.Decimal
}

View File

@ -0,0 +1,148 @@
package itemprops
//MedicalSystem организм
// Humanoid
// Circuits
// Intake
//
// Breathe: Vessel: Air intake >> mouth/nose -> trachea -> lungs
// Vessel: Blood >> heart -> lungs -> brain -> heart
// Eat:
// Vessel: food >> mouth -> jaws
// Vessel: pulp >> esophagus -> stomach
// Congestion:
// Vessel: Blood >> heart -> guts -> system -> liver -> heart
// Vessel: pulp >> stomach -> guts -> output
// Vessel: bile >> liver -> stomach -> guts
// Fast Congestion
// Vessel: liquid >> stomach -> guts -> kidney -> bladder -> pulp output
// Vessel: Blood >> heart -> guts -> system -> kidney -> heart
// Blood сirculation:
// Vessel: blood >> heart -> system -> spleen -> heart
// -> brain -> heart
// Vision:
// Vessel: Nerve signal >> eye -> brain
// Smell:
// Vessel: Air intake >> nose
// Vessel: Nerve signal >> nose -> brain
// Hearing:
// Vessel: Air pressure >> ear
// Vessel: Nerve signal >> ear -> brain
// Touching:
// Vessel: Phys pressure/Temperature/Solvent >> skin -> nerve tissue -> brain
// Motion Sense:
// Vessel: Air pressure >> ear/nose -> inner ear -> brain [feeling fast-moving items]
// Motion:
// Vessel: Gravity >> inner ear -> brain [equilibrium]
// Vessel: Nerve signal >> brain -> major nerve -> [...muscle -> tendon -> bone/joint] -> nerve tissue -> brain
// Structural:
// Vessel: Nerve signal >> brain -> spinal brain -> [...muscle] -> nerve tissue -> brain
// Psychic:
// Vessel: Nerve signal >> brain -> spinal brain -> brain
// Consciousness:
// Vessel: Nerve signal >> brain -> brain
// Misc
// Hand Grip ???:
// Vessel: Nerve signal >> palm -> fingers with off-thumb
// Stance
// Body structure:
// BasePart -> chest -> spine -> joint -> head
// -> spine -> lowerbody
// -> [left] joint -> shoulder -> joint -> arm -> joint -> palm -> 5 x finger
// -> [right] joint -> shoulder -> joint -> arm -> joint -> palm -> 5 x finger
// -> lowerbody
// -> [left] joint -> leg -> joint -> hip -> joint -> foot -> 5 x finger
// -> [right] joint -> leg -> joint -> hip -> joint -> foot -> 5 x finger
// -> head -> joint -> jaw
//MedicalSystem Организм
type MedicalSystem struct {
BasePart BodyPart
}
//MedicalCircuit Система обращения
type MedicalCircuit struct {
Provides MedicalAbility
DependsOn Organ
Vessel MedicalVessel
Contains []Organ
}
//MedicalVessel кровь, желчь, пульпа, воздух, еда
type MedicalVessel struct {
Name string
Material
Pressure DimensionItemDensity
}
//BodyPart часть тела
type BodyPart struct {
LayerExtra MedicalMaterial
LayerOuter MedicalMaterial
LayerMiddle MedicalMaterial
LayerInner MedicalMaterial
Joints []Joint
Contains []InnerOrgan
Exposes []OuterOrgan
}
//Joint суставы, к чему и что крепится
type Joint struct {
Name string
ConnectsFrom BodyPart
ConnectsTo BodyPart
}
type Organ struct {
Name string
Material
}
//InnerOrgan ливер, селезёнка, сердце, кишки итп
type InnerOrgan struct {
Organ
DependsOn MedicalCircuit
BelongsTo MedicalCircuit
}
//OuterOrgan глаза, уши, волосы, когти итп
type OuterOrgan struct {
Organ
DependsOn MedicalCircuit
BelongsTo MedicalCircuit
}
//слой части тела - кожа/чешуя/роговые пластины/хитиновый панцирь, жир, мускулы, кости
type MedicalMaterial struct {
Name string
Material
MedicalSystemFlags
}
//@todo заменить на Medical Circuit
type MedicalSystemFlags struct {
//Structural является ли опорным аппаратом
Structural bool
//Содежит ли кровь/ихор/
MajorVeins bool //вход на мотор, сломаешь - быстро выйдет из строя если будет двигаться
MajorArteria bool //выход, то же самое + высокое давление
Veins bool //вход на мотор
Arteria bool //выход из мотора, высокое давление
MajorNerve bool //повредишь - ниже по суставам не работает
NerveTissue bool //повредишь - ниже по суставамс болит
OxygenTube bool //трахея
OxygenPump bool //лёгкое
BloodPump bool //мотор
ContainsCongestionLiquid bool
IsMainCongestionPump bool
}
//MedicalAbility спсобность есть, стоять, не терять равновесие, дышать, выздоравливать, лечить свои органы, видеть итп
type MedicalAbility string

View File

@ -0,0 +1,37 @@
package itemprops
import "github.com/shopspring/decimal"
type ItemPhysics struct {
Material Material
Rigidity DimensionItemRigidity
Size DimensionItemSize
Temperature DimensionItemTemperature
}
//DimensionItemSize length in m (1 mm = 1/1000 of 1m)
type DimensionItemSize struct {
Width decimal.Decimal
Height decimal.Decimal
// if item is solid - depth in m (1mm = 1/1000 of m)
Depth decimal.NullDecimal
//Thickness if item is hollow - thickness of outer item shell, ie for armor, in m (1 mm = 1/1000 of m)
Thickness decimal.NullDecimal
}
//Area is frontal area
func (d *DimensionItemSize) Area() decimal.Decimal {
return d.Width.Mul(d.Height)
}
//DimensionItemDensity density in kg/m3
type DimensionItemDensity decimal.Decimal
//DimensionItemRigidity rigidity жёсткость, способность твёрдого тела, конструкции или её элементов сопротивляться деформации in N/m
type DimensionItemRigidity decimal.Decimal
//NotchFractureToughness ударная вязкость по Шарпи, Дж (надо ли?)
type NotchFractureToughness decimal.Decimal
//DimensionItemTemperature in celsius, -273 to 10000
type DimensionItemTemperature decimal.Decimal

View File

@ -0,0 +1,20 @@
package itemprops
type Material struct {
Name string
Flags MaterialFlags
Density DimensionItemDensity
FractureToughness NotchFractureToughness
MeltingPoint DimensionItemTemperature
BoilingPoint DimensionItemTemperature
}
type MaterialFlags struct {
ConductsElictricity bool
BlocksLiquid bool
AcidResistant bool
BlocksGas bool
Flammable bool
ConductsHeat bool
Radiates bool
}

View File

@ -1,16 +1,19 @@
package screens
import (
"context"
"fmt"
"lab.zaar.be/thefish/alchemyst-go/effects"
"lab.zaar.be/thefish/alchemyst-go/engine/ecs"
"lab.zaar.be/thefish/alchemyst-go/engine/gamestate"
"lab.zaar.be/thefish/alchemyst-go/engine/types"
"lab.zaar.be/thefish/alchemyst-go/ui/mainwindow"
"lab.zaar.be/thefish/alchemyst-go/util/appctx"
"strings"
)
type DevmenuScreen struct {
ctx context.Context
mw *mainwindow.MainWindow
controller *ecs.Controller
scm *types.ScreenManager
@ -23,8 +26,9 @@ type DevmenuScreen struct {
fgColor string
}
func NewDevmenuScreen(mw *mainwindow.MainWindow, controller *ecs.Controller, scm *types.ScreenManager, state *gamestate.GameState, rect types.Rect, renderParent bool) *DevmenuScreen {
func NewDevmenuScreen(ctx context.Context, mw *mainwindow.MainWindow, controller *ecs.Controller, scm *types.ScreenManager, state *gamestate.GameState, rect types.Rect, renderParent bool) *DevmenuScreen {
return &DevmenuScreen{
ctx: ctx,
mw: mw,
controller: controller,
scm: scm,
@ -65,7 +69,7 @@ func (devm *DevmenuScreen) HandleInput(input string) {
level.Tiles[idx].Visible = true
level.Tiles[idx].Explored = true
}
fmt.Printf("making everything visible!")
appctx.Logger(devm.ctx).Warn().Msg("making everything visible!")
devm.scm.SetScreen(devm.scm.PreviousScreen)
break
case "p":

1
go.mod
View File

@ -5,5 +5,6 @@ go 1.12
require (
github.com/gammazero/deque v0.0.0-20190521012701-46e4ffb7a622
github.com/rs/zerolog v1.15.0
github.com/shopspring/decimal v1.3.1
lab.zaar.be/thefish/bearlibterminal v0.0.0-20191018101635-dd37bbc90d77
)

2
go.sum
View File

@ -5,6 +5,8 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.15.0 h1:uPRuwkWF4J6fGsJ2R0Gn2jB1EQiav9k3S6CSdygQJXY=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=