48 lines
678 B
Go
48 lines
678 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
sbhpfv1 "git.zervo.org/FLUX/GoSBHPF/SBHPFv1"
|
|
)
|
|
|
|
func main() {
|
|
file, err := os.Create("test.bin")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
defer file.Close()
|
|
|
|
prop_a := sbhpfv1.Property{
|
|
Key: "active",
|
|
Type: sbhpfv1.TypeBool,
|
|
Value: true,
|
|
}
|
|
|
|
prop_b := sbhpfv1.Property{
|
|
Key: "level",
|
|
Type: sbhpfv1.TypeInt16,
|
|
Value: int16(27),
|
|
}
|
|
|
|
child_node := sbhpfv1.Node{
|
|
Name: "inventory",
|
|
}
|
|
|
|
node := sbhpfv1.Node{
|
|
Name: "player",
|
|
Properties: []sbhpfv1.Property{
|
|
prop_a,
|
|
prop_b,
|
|
},
|
|
Children: []*sbhpfv1.Node{
|
|
&child_node,
|
|
},
|
|
}
|
|
|
|
err = sbhpfv1.SerializeNode(file, &node)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|