-
Notifications
You must be signed in to change notification settings - Fork 0
/
netcave.py
121 lines (89 loc) · 4.31 KB
/
netcave.py
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import VRScript
import stupidDungeon, level, random
from gameController import gameController
#import Weapon
CAVE = 3
WIDTH = 32
HEIGHT = 32
DEVELOP = True
random.seed(545657451)
LEVEL = level.level()
dungeon = LEVEL.getFloor(0).dungeon
# Floor
# floor = VRScript.Core.Entity('Floor')
# fbox = VRScript.Resources.Box(VRScript.Math.Vector(HEIGHT*CAVE/2,WIDTH*CAVE/2,CAVE/2),
# VRScript.Math.Point(0,0,CAVE/2))
# floor.attach(VRScript.Core.Renderable('Floor',fbox))
# floor.renderable('').show()
# phys = VRScript.Core.Physical('Floor', fbox)
# phys.setPhysicsProperties(VRScript.Core.PhysicsProperties(0,.1,.1,.1,.2))
# phys.setCollisionType(VRScript.Core.CollisionType.Static)
# floor.attach(phys)
# insert floor
VRScript.Core.Entity('e_ground').attach(VRScript.Core.Physical('p_ground',VRScript.Resources.Plane()))
VRScript.Interaction.enableNavigation(False,0)
#USER.physical('').setPhysicsProperties(VRScript.Core.PhysicsProperties(1,.1,.1,.1,.2))
start = []
# load lights
base_lights = VRScript.Core.Entity( "BASE_LIGHTS" )
base_lights_r = VRScript.Resources.Mesh( "BASE_LIGHTS_r", "OSG_Light_0_3.osg")
base_lights.attach( VRScript.Core.Renderable( "BASE_LIGHTS_r", base_lights_r ) )
base_lights.renderable('').show()
real_lights = []
for light in range( 4 ):
real_lights.append( VRScript.Core.Entity( "Light_%d" % (light+1) ) )
light_r = VRScript.Resources.Mesh( "LIGHT_r_%d" % (light+1), "OSG_Light_%d.osg" % (light+4))
real_lights[light].attach( VRScript.Core.Renderable( "LIGHT_r_%d" % (light+1), light_r ) )
real_lights[light].renderable('').show()
gc = gameController()
gc.setLevel(LEVEL)
start = LEVEL.getFloor(0).start
gc.setUserPosition(start)
#move user to spawn
#print(start[0]*CAVE,start[1]*CAVE)
loc = VRScript.Math.Vector(-5,-5,0,0)
loc2 = VRScript.Math.Vector(start[0]*CAVE,start[1]*CAVE,loc.z,loc.w)
VRScript.Core.Entity('User0').physical('').applyImpulse(loc2-loc,VRScript.Math.Vector(0,0,0))
#start[0] = 0#start[0]*CAVE
#start[1] = 0#start[1]*CAVE
entityList = []
ambient = VRScript.Core.Audible('ambient', 'Sound Effects/ambient.wav')
props = ambient.getAudioProperties()
props.loop = True
ambient.setAudioProperties(props)
ambient.play()
print('Loading Finished')
#VRScript.Interaction.setNavigationSpeed(6,0)
#cube_e = VRScript.Core.Entity('blarg')
#cube_m = VRScript.Resources.Box(VRScript.Math.Vector(.5,.5,.5),
#VRScript.Math.Point(0,
#0,
#3.5))
#cube_e.attach(VRScript.Core.Renderable('blarg',cube_m))
#cube_e.renderable('').show()
#for y in range(len(dungeon)) :
#for x in range(len(dungeon[y])) :
#if dungeon[y][x] == 0 or dungeon[y][x]>=3:
#entityList += [makeEntity('Floor',x,y,0,start)]
#entityList += [makeEntity('Cieling',x,y,0,start)]
#if dungeon[y-1][x]==1 or dungeon[y-1][x]==2:
#entityList += [makeEntity('RightWall',x,y,0,start)]
#if dungeon[y+1][x]==1 or dungeon[y+1][x]==2:
#entityList += [makeEntity('LeftWall',x,y,0,start)]
#if dungeon[y][x+1]==1 or dungeon[y][x+1]==2:
#entityList += [makeEntity('FrontWall',x,y,0,start)]
#if dungeon[y][x-1]==1 or dungeon[y][x-1]==2:
#entityList += [makeEntity('BackWall',x,y,0,start)]
#elif dungeon[y][x] == 7 :
#print('up stairs')
#if dungeon[y][x] == 9 :
#name = 'cube[' + str(y) + '][' + str(x) + ']'
#cube_e = VRScript.Core.Entity(name)
#cube_m = VRScript.Resources.Box(VRScript.Math.Vector(.5,.5,.5),
#VRScript.Math.Point((((x*CAVE) + CAVE/2) - start[0]),
#(((y*CAVE) + CAVE/2) - start[1]),
#CAVE/2))
#cube_e.attach(VRScript.Core.Renderable(name,cube_m))
#cube_e.renderable('').show()
#elif dungeon[y][x] == 8 :
#print('down stairs')