Line data Source code
1 : package query
2 :
3 : import (
4 : "github.com/kijimaD/ruins/internal/consts"
5 : w "github.com/kijimaD/ruins/internal/world"
6 : "github.com/mlange-42/ark/ecs"
7 : )
8 :
9 : // HeatContent はエンティティの燃焼熱量を Material と Weight から導く。
10 : // 値を保持せず読み取り時に算出する。どちらかの component を欠けば0
11 : func HeatContent(world w.World, entity ecs.Entity) consts.Heat {
12 1 : if !world.Components.Material.Has(entity) || !world.Components.Weight.Has(entity) {
13 1 : return 0
14 1 : }
15 1 : kind := world.Components.Material.Get(entity).Kind
16 1 : weight := world.Components.Weight.Get(entity).Milligram
17 1 : return world.Resources.MaterialDefs.HeatOf(kind, weight)
18 : }
19 :
20 : // IsCombustible は燃やせるか、すなわち燃焼熱量が正かを返す。可燃マーカーの代わりに使う
21 : func IsCombustible(world w.World, entity ecs.Entity) bool {
22 1 : return HeatContent(world, entity) > 0
23 1 : }
|