blob: d3a2ca7cb5612bb9bdd4173231f129f2f89c7b84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
-- Global state
--win = require("window")
hc = require("party.hc.init")
--ecs = require("ecs")
--settings = require("settings")
color = require("color")
log = require("log")
MAX_LAMPS = 8
--Use a collider to decide what to render
x = {
-- client-side viewport offsets from the world
world_x: 0
world_y: 0
-- Have we selected an input type yet?
controller: { -- logical input abstraction, not a physical input device controller
text_size: 1
}
domain: "client" -- "client" or "server"
-- (Client) Level information
level: {
graphics:{} -- Client side graphics
entities:{} -- Client side entities
graphic_world: hc.new(5) -- Client side graphics world
physics_world: hc.new(1)
collider: nil -- Collider in the physics world to figure out what we can see
}
-- (Server Networked) level information
level_sync: {
name: "" -- The name of the level
data: {} -- sequence, holds arguments for level initalization
ents: {} -- holds all the entities in the level
entid: 0 -- a nonce entid, just keep increasing and allows for holes in "ents"
peers: {} -- holds peers in [peerid: string] = Entity
phys: hc.new(5) -- The physics world we need to collide with
ref: nil -- Holds a ref to the level, has things like name, get_spawn_location(), ect.
}
sync_time: () ->
am.current_time!
hub: nil -- server, filled out later
network: nil -- client, filled out later
-- Stuff that goes to the shader
geom_view: nil -- am.vec3_array
uv_view: nil -- am.vec4_array
check: () =>
assert(@level_sync.ents, "Ents is nil")
assert(type(@level_sync.ents), "ents is not a table")
}
log.info("At the end of src/world.moon, world_x is" .. tostring(x.world_x))
x
|