1
0
Fork 0

auts: updates for latest v

This commit is contained in:
coaljoe 2020-09-05 14:06:27 +03:00
parent e3ed1e70ec
commit be727efd04
7 changed files with 26 additions and 11 deletions

View File

@ -14,6 +14,8 @@ fn new_effect() &Effect {
e := &Effect{ e := &Effect{
//in_elem: null, //in_elem: null,
//out_elem: null, //out_elem: null,
in_elem: &Elem(0),
out_elem: &Elem(0),
} }
return e return e
} }

View File

@ -62,10 +62,13 @@ mut:
} }
fn new_elem() &Elem { fn new_elem() &Elem {
/*
e := &Elem{ e := &Elem{
//when_crushed_effects: []Effect{}, //when_crushed_effects: []Effect{},
//when_crushed_out_elems: []Elem{}, //when_crushed_out_elems: []Elem{},
//generic_processor0: none, //generic_processor0: none,
} }
*/
e := &Elem{}
return e return e
} }

View File

@ -15,7 +15,7 @@ mut:
} }
fn new_generic_crusher_processor() &GenericCrusherProcessor { fn new_generic_crusher_processor() &GenericCrusherProcessor {
gcp := &GenericCrusherProcessor{} mut gcp := &GenericCrusherProcessor{}
gcp.name = "generic_crusher_processor" gcp.name = "generic_crusher_processor"
return gcp return gcp
} }

21
main.v
View File

@ -44,19 +44,20 @@ fn main() {
// Effects // Effects
// //
ef := new_effect() mut ef := new_effect()
ef.name = "melt" ef.name = "melt"
ef.in_elem = e2 ef.in_elem = e2
ef.out_elem = e3 ef.out_elem = e3
ef.cond_temp = 5000 ef.cond_temp = 5000
println("ef: ${ef}") // XXX bug: can't print recursive elems?
//println("ef: ${ef}")
// //
// Objects // Objects
// //
ob := new_object() mut ob := new_object()
ob.name = "stone1" ob.name = "stone1"
ob.dim_x = 2 ob.dim_x = 2
ob.dim_y = 2 ob.dim_y = 2
@ -68,13 +69,14 @@ fn main() {
ob.transform.pos_y = 10.0 ob.transform.pos_y = 10.0
ob.transform.rot_z = 45.0 ob.transform.rot_z = 45.0
println("ob: ${ob}") // XXX
//println("ob: ${ob}")
// //
// Processors // Processors
// //
prc := new_processor() mut prc := new_processor()
prc.name = "crushed_stone" prc.name = "crushed_stone"
prc.in_elem = e4 prc.in_elem = e4
prc.out_elem = e4 prc.out_elem = e4
@ -82,7 +84,8 @@ fn main() {
prc.req_electricity = true prc.req_electricity = true
prc.req_power = 1000 prc.req_power = 1000
println("prc: ${prc}") // XXX
//println("prc: ${prc}")
// //
// Universal Processors? // Universal Processors?
@ -96,7 +99,7 @@ fn main() {
prc2.process(ob) prc2.process(ob)
*/ */
gcp := new_generic_crusher_processor() mut gcp := new_generic_crusher_processor()
gcp.process(ob) gcp.process(ob)
//e4.generic_processor0 = gcp //e4.generic_processor0 = gcp
@ -110,7 +113,7 @@ fn main() {
// World // World
// //
w := new_world() mut w := new_world()
b1 := Bit{ b1 := Bit{
elem_type: .wood, elem_type: .wood,
@ -127,7 +130,7 @@ fn main() {
// Complex object // Complex object
// //
ob2 := new_object() mut ob2 := new_object()
ob2.name = "pipe" // Reinforced-concrete pipe, a 3d object ob2.name = "pipe" // Reinforced-concrete pipe, a 3d object
ob2.elem = e_concrete ob2.elem = e_concrete

View File

@ -30,6 +30,7 @@ mut:
fn new_object() &Object { fn new_object() &Object {
o := &Object{ o := &Object{
elem: &Elem(0),
transform: new_transform(), transform: new_transform(),
} }
return o return o

View File

@ -16,6 +16,9 @@ mut:
} }
fn new_processor() &Processor { fn new_processor() &Processor {
p := &Processor{} p := &Processor{
in_elem: &Elem(0),
out_elem: &Elem(0),
}
return p return p
} }

3
run.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
v run .