-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevents.cs
95 lines (81 loc) · 3.11 KB
/
events.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
// --- Event registration // Why do we put these at the top?
registerInputEvent(fxDTSBrick, "dayCycleOnDawn","Self fxDTSBrick\tMinigame Minigame");
registerInputEvent(fxDTSBrick, "dayCycleOnNoon","Self fxDTSBrick\tMinigame Minigame");
registerInputEvent(fxDTSBrick, "dayCycleOnDusk","Self fxDTSBrick\tMinigame Minigame");
registerInputEvent(fxDTSBrick, "dayCycleOnMidnight","Self fxDTSBrick\tMinigame Minigame");
// --- Events
// - I'm only gonna comment one of these, the others are all the same.
// - V8: Removed player and client targets - they aren't stable
function fxDTSBrick::dayCycleOnDawn(%this)
{
$inputTarget_Self = %this; // %this is the brick that the event is called on.
// $inputTarget_Player = ; // this defines the player as the player of the client of %this. //removed because useless and unclean - I can't do isObject checks on these safely.
// $inputTarget_Client = %this.client; // this defines the client as the client of %this.
$inputTarget_Minigame = getMinigameFromObject(%this); // this defines the minigame as the minigame of the client of %this.
%this.processInputEvent("dayCycleOnDawn", %this.client); // this causes the event to run. very important.
DayCyclesDebug("Processing dawn on " @ %this);
}
function fxDTSBrick::dayCycleOnNoon(%this)
{
$inputTarget_Self = %this;
// $inputTarget_Player = %this.client.player;
// $inputTarget_Client = %this.client;
$inputTarget_Minigame = getMinigameFromObject(%this);
%this.processInputEvent("dayCycleOnNoon", %this.client);
DayCyclesDebug("Processing noon on " @ %this);
}
function fxDTSBrick::dayCycleOnDusk(%this)
{
$inputTarget_Self = %this;
// $inputTarget_Player = %this.client.player;
// $inputTarget_Client = %this.client;
$inputTarget_Minigame = getMinigameFromObject(%this);
%this.processInputEvent("dayCycleOnDusk", %this.client);
DayCyclesDebug("Processing dusk on " @ %this);
}
function fxDTSBrick::dayCycleOnMidnight(%this)
{
$inputTarget_Self = %this;
// $inputTarget_Player = %this.client.player;
// $inputTarget_Client = %this.client;
$inputTarget_Minigame = getMinigameFromObject(%this);
%this.processInputEvent("dayCycleOnMidnight", %this.client);
DayCyclesDebug("Processing midnight on " @ %this);
}
function doEventsByList(%mode)
{
DayCyclesDebug("Processing events...");
for(%i = 0; %i < getWordCount($DayCycleBrickList); %i++)
{
%b = getWord($DayCycleBrickList, %i);
if(!isObject(%b))
{
$DayCycleBrickList = removeItemFromList($DayCycleBrickList, %b);
continue;
}
switch$(%mode)
{
case "Dawn":
%b.dayCycleOnDawn();
case "Noon":
%b.dayCycleOnNoon();
case "Dusk":
%b.dayCycleOnDusk();
case "Midnight":
%b.dayCycleOnMidnight();
}
DayCyclesDebug("Events processed on:" SPC %b);
}
}
function gameConnection::removeEventsByClient(%this)
{
for(%i = 0; %i < getWordCount($DayCycleBrickList); %i++)
{
%b = getWord($DayCycleBrickList, %i);
if(getBrickGroupFromObject(%brick).bl_id $= %this.bl_id)
{
removeItemFromList($DayCycleBrickList, %b);
}
DayCyclesDebug("Events processed on:" SPC %b);
}
}