1
0
Fork 0
This commit is contained in:
coaljoe 2020-09-15 18:03:00 +03:00
parent 2a7707813d
commit 1466b9bde0
2 changed files with 42 additions and 44 deletions

View File

@ -31,4 +31,42 @@ fn init_elem_lib() {
bits_ctx.elem_lib["sand"] = el
}
{
mut el := new_elem()
el.name = "glass"
el.elem_type = .glass
el.density = 2200
bits_ctx.elem_lib["glass"] = el
}
{
mut el := new_elem()
el.name = "wood"
el.elem_type = .wood
el.density = 100
el.flameable = true
bits_ctx.elem_lib["wood"] = el
}
{
mut el := new_elem()
el.name = "water"
el.elem_type = .water
el.density = 10000
el.liquid = true
bits_ctx.elem_lib["water"] = el
}
{
mut el := new_elem()
el.name = "concrete"
el.elem_type = .concrete
el.density = 20000
bits_ctx.elem_lib["concrete"] = el
}
}

View File

@ -8,46 +8,6 @@ pub fn bits_main() {
init_elem_lib()
mut e := new_elem()
e.name = "wood"
e.elem_type = .wood
e.density = 100
e.flameable = true
_ = e
println("e: ${e}")
mut e2 := new_elem()
e2.name = "sand"
e2.elem_type = .sand
e2.density = 2000
println("e2: ${e2}")
mut e3 := new_elem()
e3.name = "glass"
e3.elem_type = .glass
e3.density = 2200
mut e4 := new_elem()
e4.name = "stone"
e4.elem_type = .stone
e4.density = 8000
println("e4: ${e4}")
mut e_water := new_elem()
e_water.name = "water"
e_water.elem_type = .water
e_water.density = 10000
e_water.liquid = true
mut e_concrete := new_elem()
e_concrete.name = "concrete"
e_concrete.elem_type = .concrete
e_concrete.density = 20000
//
// Effects
//
@ -56,8 +16,8 @@ pub fn bits_main() {
mut ef := new_effect()
ef.name = "melt"
ef.in_elem = e2
ef.out_elem = e3
ef.in_elem = bits_ctx.elem_lib["sand"]
ef.out_elem = bits_ctx.elem_lib["glass"]
ef.cond_temp = 5000
// XXX bug: can't print recursive elems?
@ -83,7 +43,7 @@ pub fn bits_main() {
//ob.mat_info.add_elem_from_size([2, 2, 2], e4)
//ob.parts_info.add_elem_from_size([f32(2.), 2., 2.], e4)
//ob.parts_info.add_elem_from_size(2, 2, 2, e4)
ob.mat_info.add_elem_from_size(2, 2, 2, e4)
ob.mat_info.add_elem_from_size(2, 2, 2, bits_ctx.elem_lib["stone"])
// Position
//ob.transform.pos_x = 10.0
@ -108,7 +68,7 @@ pub fn bits_main() {
mut prc := new_processor()
prc.name = "crushed_stone"
prc.in_elem = e4
prc.in_elem = bits_ctx.elem_lib["stone"]
//prc.out_elem = e4
//prc.output_factor = 0.6
//prc.req_electricity = true