-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.cs
160 lines (140 loc) · 3.56 KB
/
server.cs
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
// delaying execution of light creating until the colorset can be loaded in its entirety
exec("./lights.cs");
schedule(0,0,Mining_initLights);
exec("./sounds.cs");
exec("./support.cs");
//ugh, blockland
$Mining::Root = "Add-Ons/Gamemode_Mining2";
function setMiningVersion() {
if(!isFile($Mining::Root @ "/.git/refs/heads/master")) {
$Mining::Version = "UNDF?";
return;
}
%file = new FileObject();
%file.openForRead($Mining::Root @ "/.git/refs/heads/master");
$Mining::Version = getSubStr(%file.readLine(),0,7);
%file.close();
%file.delete();
}
setMiningVersion();
function initMining() {
if(isObject(BiomeList)) {
for(%i=0;%i<BiomeList.getCount();%i++) {
BiomeList.getObject(%i).delete();
}
BiomeList.delete();
}
if(isObject(MiningClass)) {
for(%i=0;%i<MiningClass.getCount();%i++) {
MiningClass.getObject(%i).delete();
}
MiningClass.delete();
}
%set = new SimSet(MiningClass) {
timeInit = getSimTime();
};
%file = new FileObject();
%biomes = new SimSet(BiomeList);
%file.openForRead($Mining::Root @ "/db/biomes.db");
while(!%file.isEOF()) {
%line = %file.readLine();
if(getSubStr(%line,0,2) $= "//") {
continue;
}
%biome = new ScriptObject(MiningBiome) {
type = getField(%line,0);
color = getField(%line,1);
health = getField(%line,2);
rarity = getField(%line,3);
max_ore_lvl = getField(%line,4);
};
%biomes.add(%biome);
}
%file.close();
%ores = new SimSet(OreList);
%file.openForRead($Mining::Root @ "/db/ores.db");
while(!%file.isEOF()) {
%line = %file.readLine();
if(getSubStr(%line,0,2) $= "//") {
continue;
}
%ore = new ScriptObject(MiningBiome) {
type = getField(%line,0);
color = getField(%line,1);
health = getField(%line,2);
rarity = getField(%line,3);
value = getField(%line,4);
lvl = getField(%line,5);
};
%ores.add(%ore);
}
%file.close();
%liquids = new SimSet(LiquidList);
%file.openForRead($Mining::Root @ "/db/liquids.db");
while(!%file.isEOF()) {
%line = %file.readLine();
if(getSubStr(%line,0,2) $= "//") {
continue;
}
%liquid = new ScriptObject(MiningBiome) {
type = getField(%line,0);
color = getField(%line,1);
rarity = getField(%line,2);
hazardous = getField(%line,3);
};
%liquids.add(%liquid);
}
%file.close();
%file.delete();
%set.add(%biomes);
%set.add(%ores);
%set.add(%liquids);
return %set;
}
if(!isObject($MiningSet)) {
$MiningSet = initMining();
}
exec("./player_functions.cs");
exec("./brick_functions.cs");
exec("./liquid_functions.cs");
exec("./db_functions.cs");
exec("./bot_functions.cs");
exec("./explosions.cs");
exec("./levels.cs");
exec("./commands.cs");
exec("./gui.cs");
exec("./saving.cs");
exec("./trading.cs");
PlayerStandardArmor.jumpForce = "1300";
PlayerStandardArmor.jetEnergyDrain = "0.1";
PlayerStandardArmor.minJetEnergy = "0.1";
PlayerStandardArmor.rechargeRate = "0";
PlayerStandardArmor.showEnergyBar = "1";
package MiningServerPackage {
function onServerDestroyed() {
deleteVariables("$Mining::*");
return parent::onServerDestroyed();
}
};
activatePackage(MiningServerPackage);
function doSpawn() {
Mining_newBrick(48,48,2500);
schedule(400,0,Mining_doExplosion,$Mining::Brick[48,48,2500],30);
PlayerDropPoints.delete();
%points = new SimGroup(PlayerDropPoints) {
new SpawnSphere() {
position = "48 48 2350";
rotation = "0 0 1 130.062";
scale = "0.940827 1.97505 1";
dataBlock = "SpawnSphereMarker";
canSetIFLs = "0";
radius = "20";
sphereWeight = "1";
indoorWeight = "1";
outdoorWeight = "1";
RayHeight = "150";
};
};
MissionGroup.add(%points);
}
schedule(100,0,doSpawn);