-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJuly Project.dm
166 lines (121 loc) · 2.56 KB
/
July Project.dm
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
*
*
*/
var/const
MOD_FLAT = 1
MOD_PROP = 2
STAT_VALUE = 1
STAT_MIN_VALUE = 2
STAT_MAX_VALUE = 3
PATH_COST = 10
PATH_MAX_LEN = 8
var
serverTime //server-time in seconds
deltaTime //duration of each server tick, in seconds.
maxServerTime = 100000//If the servertime reaches this threshhold, then the serverTime is at risk of timer errors.
//A server reboot at this point is necessary to prevent these errors
pauseGame //This is a bool that will pause the game
tickSpeedMult = 1 //A tick speed multiplier. x1.0 is 100% game speed. x2.0 is 200% game speed.
activeClients[0]
activeDatums[0]
list/triggers
list/slots
list/admins
list/chatGroups
chatGroup/debug
chatGroup/world_
world
icon_size = 32
fps = 30
mob = /player
New()
worldInitialization()
.=..()
gameLogicLoop()
proc
worldInitialization()
// Trigger initialization
triggers = list(
"Physical Offense",
"Physical Defense",
"Magical Offense",
"Magical Defense",
"Kill",
"Death",
"Move",
"Opportunity Offense",
"Opportunity Defense")
// Slots initialization
slots = list(
"Helmet",
"Armor",
"Belt",
"Left Hand",
"Right Hand",
"Left Ring",
"Right Ring",
"Amulet")
// Chat groups initialization
chatGroups = list()
debug = new /chatGroup("Debug")
world_ = new /chatGroup("World")
chatGroups += debug
chatGroups += world_
// Admins initialization
admins = list("gooseheaded", "d4rk354b3r")
world.maxx = 1
world.maxy = 1
world.maxz = 1
gameLogicLoop()
while(1)
if(pauseGame)
sleep(0)
sleep(world.tick_lag)
sleep(0)
deltaTime = world.tick_lag/10 * tickSpeedMult
serverTime += deltaTime
sleep(world.tick_lag)
for(var/client/C in activeClients)
if(C.tickTimer <= serverTime)
C.Tick()
for(var/datum/D in activeDatums)
if(D.tickTimer <= serverTime)
D.Tick()
//if the serverTime >= maxServerTime then we are going to have problems.
//reboot son!
if(serverTime >= maxServerTime)
maintenanceReboot()
maintenanceReboot()
//tell the world that a reboot is imminent
//put all players in "transit" space
//save all player characters
//save all maps if applicable
//clean up and dispose of all resources
//reboot
sleep(5)
world.Reboot(0)
datum
var
isActive = 0
tickTimer
New()
.=..()
if(isActive) activeDatums += src
Del()
if(isActive) activeDatums -= src
.=..()
proc
Tick()
client
var
tickTimer
New()
.=..()
view = "[screen_x]x[screen_y]"
activeClients += src
Del()
activeClients -= src
.=..()
proc
Tick()