-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransmitNewFiles.cs
164 lines (138 loc) · 3.92 KB
/
transmitNewFiles.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
161
162
163
164
// package vNoPickup {
// function Armor::onCollision(%this, %obj, %col, %vel, %speed) {
// if (%col.getDatablock().getName() $= "vapeNoColorItem") {
// return;
// }
// return parent::onCollision(%this, %obj, %col, %vel, %speed);
// }
// };
// activatePackage(vNoPickup);
// package Bobme {
// function serverCmdMessageSent(%cl, %msg) {
// if (%cl.isBob) {
// if (%cl.lastMessage $= %msg) {
// spamAlert(%cl);
// return;
// }
// messageAll('', "\c3bob\c6: " @ stripMLControlChars(%msg));
// return;
// } else {
// return parent::serverCmdMessageSent(%cl, %msg);
// }
// }
// function GameConnection::spawnPlayer(%cl) {
// %ret = parent::spawnPlayer(%cl);
// if (%cl.isBob) {
// %cl.player.setShapeName("bob", 8564862);
// }
// return %ret;
// }
// };
// activatePackage(Bobme);
// function serverCmdBob(%cl, %targ) {
// if (!%cl.isAdmin) {
// return;
// } else if (!isObject(%obj = findClientByName(%targ))) {
// messageClient(%cl, '', "Cannot find client by name of " @ %targ);
// }
// %obj.isBob = 1;
// if (isObject(%obj.player))
// %obj.player.setShapeName("bob", 8564862);
// }
// function serverCmdUnBob(%cl, %targ) {
// if (!%cl.isAdmin) {
// return;
// } else if (!isObject(%obj = findClientByName(%targ))) {
// messageClient(%cl, '', "Cannot find client by name of " @ %targ);
// }
// %obj.isBob = 0;
// if (isObject(%obj.player))
// %obj.player.setShapeName(%obj.name, 8564862);
// }
// function serverCmdBobAll(%cl) {
// if (!%cl.isAdmin) {
// return;
// }
// for (%i = 0; %i < ClientGroup.getCount(); %i++) {
// %obj = ClientGroup.getObject(%i);
// %obj.isBob = 1;
// if (isObject(%obj.player))
// %obj.player.setShapeName("bob", 8564862);
// }
// }
// function serverCmdUnBobAll(%cl) {
// if (!%cl.isAdmin) {
// return;
// }
// for (%i = 0; %i < ClientGroup.getCount(); %i++) {
// %obj = ClientGroup.getObject(%i);
// %obj.isBob = 0;
// if (isObject(%obj.player))
// %obj.player.setShapeName(%obj.name, 8564862);
// }
// }
package DisableDatablockChange {
function serverCmdAddEvent(%cl, %en, %inputEventIdx, %delay, %targetIdx, %NTNameIdx, %outputEventIdx, %par1, %par2, %par3, %par4)
{
if (!%cl.isAdmin && (%par1.getID() == DragonArmor.getID() || %par1.getID() == MadmanPlArmor.getID()) ) {
messageClient(%cl, '', "You cannot set events with Dragon or Madman as the datablock!");
return;
}
else
{
return parent::serverCmdAddEvent(%cl, %en, %inputEventIdx, %delay, %targetIdx, %NTNameIdx, %outputEventIdx, %par1, %par2, %par3, %par4);
}
}
};
activatePackage(DisableDatablockChange);
if(!isObject(ActiveDownloadSet))
new SimSet(ActiveDownloadSet);
function transmitNewFiles()
{
if(ActiveDownloadSet.getCount() != 0)
{
messageAll('', "\c6Downloads are already in progress! Cannot start again until finished.");
return;
}
messageAll('', "\c6Starting download of new files...");
setManifestDirty();
%hash = snapshotGameAssets();
for(%i = 0; %i < ClientGroup.getCount(); %i++)
{
%client = ClientGroup.getObject(%i);
if(!%client.hasSpawnedOnce)
{
commandToClient(%client, 'GameModeChange');
%client.schedule(10, delete, "Please rejoin!");
}
else
{
%client.sendManifest(%hash);
ActiveDownloadSet.add(%client);
}
}
}
package ReDownload
{
function serverCmdBlobDownloadFinished(%client)
{
parent::serverCmdBlobDownloadFinished(%client);
if(ActiveDownloadSet.isMember(%client))
{
ActiveDownloadSet.remove(%client);
if(ActiveDownloadSet.getCount() == 0)
schedule(1000, 0, messageAll, '', "\c6All clients finished downloading the new files!");
}
}
function GameConnection::onClientLeaveGame(%client)
{
if(ActiveDownloadSet.isMember(%client))
{
ActiveDownloadSet.remove(%client);
if(ActiveDownloadSet.getCount() == 0)
schedule(1000, 0, messageAll, '', "\c6All clients finished downloading the new files!");
}
parent::onClientLeaveGame(%client);
}
};
activatePackage(ReDownload);