You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AM2R-The-Horde-Multitroid/objects/oClient.object.gmx

1028 lines
37 KiB

<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>&lt;undefined&gt;</spriteName>
<solid>0</solid>
<visible>0</visible>
<depth>0</depth>
<persistent>-1</persistent>
<parentName>&lt;undefined&gt;</parentName>
<maskName>&lt;undefined&gt;</maskName>
<events>
<event eventtype="0" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>network_set_config(network_config_connect_timeout, 5000);
strict_init("dictionary.json");
canSend = false;
metroidCountChanged = false;
itemChanged = false;
metdeadChanged = false;
eventChanged = false;
connected = false;
queenHealthWait = false;
queenDead = false;
drawUpdate = false;
phase = 0;
seed = undefined;
var type;
type = network_socket_tcp;
ini_open(working_directory + "\mod settings.ini");
ipaddress = ini_read_string("ModSettings", "ipaddress", "127.0.0.1");
name = ini_read_string("ModSettings", "displayname", "name");
ini_close();
port = 64198;
socket = network_create_socket(type);
isConnected = network_connect(socket, ipaddress, port);
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);
global.queenhealthPrev = 600;
global.queenphasePrev = 0;
if(instance_exists(oCharacter)){
global.prevX = oCharacter.x;
global.prevY = oCharacter.y;
global.prevSprite = oCharacter.sprite_index;
global.prevIndex = oCharacter.image_index;
}
global.roomPrev = room;
global.clientID = 0;
global.packetID = 0;
global.receivedPacketID = 0;
global.onlineList = ds_grid_create(3, 35);
global.onlineSend = ds_grid_create(3, 35);
global.onlineItem = ds_grid_create(1, 1);
global.onlineMetdead = ds_grid_create(1, 1);
global.onlineEvent = ds_grid_create(1, 1);
global.onlineReceived = ds_grid_create(3, 35);
//global.storedBuffers = ds_grid_create(2, 1);
global.receivedPacketIDs = ds_list_create();
roomList = ds_list_create();
roomListData = ds_list_create();
ds_grid_clear(global.onlineSend, -1);
ds_grid_clear(global.onlineItem, -1);
ds_grid_clear(global.onlineMetdead, -1);
ds_grid_clear(global.onlineEvent, -1);
ds_grid_clear(global.onlineReceived, -1);
for(var i=0; i&lt;ds_grid_height(global.onlineList); i++){
ds_grid_set(global.onlineList, 2, i, i);
}
update_variables("initprev");
update_variables("onlinevars");
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="1" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>network_destroy(socket);
buffer_delete(buffer);
ds_grid_destroy(global.onlineList);
ds_grid_destroy(global.onlineSend);
ds_grid_destroy(global.onlineReceived);
//ds_grid_destroy(global.storedBuffers);
ds_grid_destroy(global.onlineItem);
ds_grid_destroy(global.onlineMetdead);
ds_grid_destroy(global.onlineEvent);
ds_list_destroy(global.receivedPacketIDs);
ds_list_destroy(roomList);
ds_list_destroy(roomListData);
if(connected){
popup_text("Disconnected");
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="2" enumb="5">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>var v = 0;
for(var f=0; f&lt;array_length_1d(global.event); f++){
if(global.eventPrev[f] != global.event[f]){
global.eventChanges[v, 0] = global.event[f];
global.eventChanges[v, 1] = f;
global.onlineEvent[# 0, 0] = global.eventChanges;
show_debug_message(string(global.eventPrev[f]) + " " + string(global.event[f]));
show_debug_message("event changed");
eventChanged = true;
v++;
}
}
if(eventChanged){
buffer_delete(buffer);
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_u8, 8);
buffer_write(buffer, buffer_string, strict_compress(ds_grid_write(global.onlineEvent)));
buffer_write(buffer, buffer_u8, global.clientID);
var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}
if(!eventChanged){
alarm[5] = 30;
}
if(eventChanged){
eventChanged = false;
alarm[5] = 75;
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="2" enumb="4">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>var v = 0;
for(var f=0; f&lt;array_length_1d(global.metdead); f++){
if(global.metdeadPrev[f] != global.metdead[f]){
global.metdeadChanges[v, 0] = global.metdead[f];
global.metdeadChanges[v, 1] = f;
global.onlineMetdead[# 0, 0] = global.metdeadChanges;
show_debug_message(string(global.metdeadPrev[f]) + " " + string(global.metdead[f]));
show_debug_message("metdead changed");
metdeadChanged = true;
v++;
}
}
if(metdeadChanged){
buffer_delete(buffer);
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_u8, 7);
buffer_write(buffer, buffer_string, strict_compress(ds_grid_write(global.onlineMetdead)));
buffer_write(buffer, buffer_u8, global.clientID);
var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}
if(!metdeadChanged){
alarm[4] = 30;
}
if(metdeadChanged){
metdeadChanged = false;
alarm[4] = 75;
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="2" enumb="3">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>var v = 0;
for(var f=0; f&lt;array_length_1d(global.item); f++){
if(global.itemPrev[f] != global.item[f]){
global.itemChanges[v, 0] = global.item[f];
global.itemChanges[v, 1] = f;
global.onlineItem[# 0, 0] = global.itemChanges;
show_debug_message(string(global.itemPrev[f]) + " " + string(global.item[f]));
show_debug_message("item changed");
itemChanged = true;
v++;
}
}
if(itemChanged){
buffer_delete(buffer);
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_u8, 6);
buffer_write(buffer, buffer_string, strict_compress(ds_grid_write(global.onlineItem)));
buffer_write(buffer, buffer_u8, global.clientID);
var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}
if(!itemChanged){
alarm[3] = 30;
}
if(itemChanged){
itemChanged = false;
alarm[3] = 75;
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="2" enumb="2">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>if(global.monstersleftPrev != global.monstersleft){
buffer_delete(buffer);
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_u8, 4);
buffer_write(buffer, buffer_s8, global.monstersleft);
buffer_write(buffer, buffer_u8, global.clientID);
var result = network_send_packet(socket, buffer, buffer_tell(buffer));
metroidCountChanged = true;
}
if(global.monstersareaPrev != global.monstersarea){
buffer_delete(buffer);
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_u8, 5);
buffer_write(buffer, buffer_s8, global.monstersarea);
buffer_write(buffer, buffer_u8, global.clientID);
var result = network_send_packet(socket, buffer, buffer_tell(buffer));
metroidCountChanged = true;
}
if(!metroidCountChanged){
alarm[2] = 30;
}
if(metroidCountChanged){
metroidCountChanged = false;
alarm[2] = 75;
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="2" enumb="1">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>if(queenHealthResetQueued){
if(!is_undefined(oQueenHead.myhealth) &amp;&amp; !is_undefined(oQueen.phase)){
oQueenHead.myhealth = queenHealth;
oQueen.phase = phase;
if(state == 100){
oQueen.state = state;
oQueen.statetime = 0;
}
queenHealthResetQueued = false;
}
alarm[1] = 5;
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="2" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>
update_variables("onlinevars");
for(var i=0; i&lt;ds_grid_height(global.onlineList); i++){
if(global.onlineList[# 0, i] != global.onlineList[# 1, i] &amp;&amp; i != 0 &amp;&amp; i != 1 &amp;&amp; i != 3){
global.onlineSend[# 0, i] = global.onlineList[# 0, i];
global.onlineSend[# 1, i] = global.onlineList[# 1, i];
global.onlineSend[# 2, i] = global.onlineList[# 2, i];
show_debug_message(string(global.onlineSend[# 0, i]) + " " + string(global.onlineSend[# 1, i]) + " " + string(global.onlineSend[# 2, i]));
canSend = true;
alarm[0] = 600;
}
/*
if(i == 0){
var v = 0;
var itemPrev = global.onlineList[# 0, 0];
var item = global.onlineList[# 1, 0];
for(var f=0; f&lt;array_length_1d(item); f++){
if(itemPrev[f] != item[f]){
global.itemChanges[v, 0] = global.item[f];
global.itemChanges[v, 1] = f;
global.onlineSend[# 1, 0] = global.itemChanges;
global.onlineSend[# 2, 0] = global.onlineList[# 2, 0];
show_debug_message(string(global.itemPrev[f]) + " " + string(global.item[f]));
show_debug_message("item changed");
canSend = true;
v++;
}
}
}
if(i == 1){
var v = 0;
var metdeadPrev = global.onlineList[# 0, 1];
var metdead = global.onlineList[# 1, 1];
for(var f=0; f&lt;array_length_1d(metdead); f++){
if(metdeadPrev[f] != metdead[f]){
global.metdeadChanges[v, 0] = global.metdead[f];
global.metdeadChanges[v, 1] = f;
global.onlineSend[# 1, 1] = global.metdeadChanges;
global.onlineSend[# 2, 1] = global.onlineList[# 2, 1];
show_debug_message(string(global.metdeadPrev[f]) + " " + string(global.metdead[f]));
show_debug_message("metdead changed");
canSend = true;
v++;
}
}
}
if(i == 3){
var v = 0;
var eventPrev = global.onlineList[# 0, 3];
var event = global.onlineList[# 1, 3];
for(var f=0; f&lt;array_length_1d(eventPrev) - 1; f++){
if(eventPrev[f] != event[f]){
global.eventChanges[v, 0] = global.event[f];
global.eventChanges[v, 1] = f;
global.onlineSend[# 1, 3] = global.eventChanges;
global.onlineSend[# 2, 3] = global.onlineList[# 2, 3];
show_debug_message(string(global.eventPrev[f]) + " " + string(global.event[f]));
show_debug_message("event changed");
canSend = true;
v++;
}
}
}
*/
}
if(canSend){
buffer_delete(buffer);
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_u8, 0);
buffer_write(buffer, buffer_string, strict_compress(ds_grid_write(global.onlineSend)));
buffer_write(buffer, buffer_u8, global.clientID);
buffer_write(buffer, buffer_u32, global.packetID);
//global.storedBuffers[# 0, global.packetID] = global.onlineSend;
//global.storedBuffers[# 1, global.packetID] = global.clientID;
var result = network_send_packet(socket, buffer, buffer_tell(buffer));
show_debug_message("packetID = " + string(global.packetID));
global.packetID++;
//ds_grid_resize(global.storedBuffers, 2, global.packetID + 1);
ds_grid_clear(global.onlineSend, -1);
}
if(!canSend){
alarm[0] = 30;
}
if(canSend){
canSend = false;
alarm[0] = 75;
}
check_areaclear();
if(global.playerhealth &lt;= 0){
if(oCharacter.state != oCharacter.DEFEATED){
oCharacter.alarm[0] = 6;
oCharacter.state = oCharacter.DEFEATED;
}
}
if(instance_exists(oQueenHead) &amp;&amp; !is_undefined(oQueenHead.myhealth) &amp;&amp; !is_undefined(oQueen.phase)){
if(global.queenhealthPrev != oQueenHead.myhealth || oQueen.phase != phase){
show_debug_message("queen health sent " + string(oQueenHead.myhealth));
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_u8, 2);
buffer_write(buffer, buffer_s16, oQueenHead.myhealth);
buffer_write(buffer, buffer_u8, global.clientID);
buffer_write(buffer, buffer_s8, oQueen.phase);
buffer_write(buffer, buffer_s8, oQueen.state);
var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="3" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>if(!connected){
if(isConnected &gt;= 0){
connected = true;
popup_text("Connected");
buffer_delete(buffer);
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_u8, 1);
var result = network_send_packet(socket, buffer, buffer_tell(buffer));
alarm[0] = 5;
alarm[2] = 5;
alarm[3] = 5;
alarm[4] = 5;
alarm[5] = 5;
} else {
instance_destroy();
popup_text("Failed to connect");
}
}
if(instance_exists(oQueen) &amp;&amp; !is_undefined(oQueen.phase)){
if(oQueen.phase &lt; phase){
oQueen.phase = phase;
} else if(oQueen.phase &gt; phase &amp;&amp; global.event[303] == 0){
phase = oQueen.phase;
}
}
if(global.event[303] &gt; 0){
phase = 0;
}
if(instance_exists(oQueen) &amp;&amp; !is_undefined(oQueen.phase)){
if(phase &gt;= 1 &amp;&amp; instance_exists(inst_146524)){
event_perform_object(oQueenFireball, ev_other, ev_user1);
}
if(phase &gt;= 2 &amp;&amp; instance_exists(inst_146525) &amp;&amp; instance_exists(inst_146520)){
event_perform_object(oQueenFireball, ev_other, ev_user2);
}
if(phase &gt;= 3 &amp;&amp; instance_exists(inst_146526) &amp;&amp; instance_exists(inst_146514)){
event_perform_object(oQueenFireball, ev_other, ev_user3);
}
if(phase &gt;= 4 &amp;&amp; instance_exists(inst_146527)){
event_perform_object(oQueenFireball, ev_other, ev_user4);
}
if(global.event[303] &gt; 0 &amp;&amp; !queenDead){
with(oQueen){
height_target_front = 10;
height_target_back = 10;
head_obj.push = 0;
head_obj.canhit = 0;
head_obj.state = 100;
head_obj.statetime = 0;
leg1f_obj.canhit = 0;
leg1b_obj.canhit = 0;
head_target_x = x + neck_x + 40;
head_target_y = y + neck_y + 5;
alarm[9] = 1;
alarm[10] = 300;
head_obj.alarm[9] = 1;
head_obj.alarm[10] = 280;
canhit = 0;
mus_fadeout(musQueen);
mus_fadeout(musQueen3);
oMusicV2.bossbgm = sndJump;
sfx_play(sndQueenDeath);
}
queenDead = true;
}
}
if(connected){
if(instance_exists(oCharacter)){
if(oCharacter.x != global.prevX || oCharacter.y != global.prevY || global.roomPrev != room || global.prevSprite != oCharacter.sprite_index || global.prevIndex != oCharacter.image_index){
if(global.prevX != oCharacter.x){
global.prevX = oCharacter.x;
}
if(global.prevY != oCharacter.y){
global.prevY = oCharacter.y;
}
if(global.roomPrev != room){
global.roomPrev = room;
}
if(global.prevSprite != oCharacter.sprite_index){
global.prevSprite = oCharacter.sprite_index;
}
if(global.prevIndex != oCharacter.image_index){
global.prevIndex = oCharacter.image_index;
}
buffer_delete(buffer);
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
buffer = buffer_create(size, type, alignment);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_u8, 100);
buffer_write(buffer, buffer_u8, global.clientID);
buffer_write(buffer, buffer_s16, oCharacter.x);
buffer_write(buffer, buffer_s16, oCharacter.y);
buffer_write(buffer, buffer_s16, oCharacter.sprite_index);
buffer_write(buffer, buffer_s16, oCharacter.image_index);
buffer_write(buffer, buffer_s16, room);
var result = network_send_packet(socket, buffer, buffer_tell(buffer));
}
}
}
if(keyboard_check_pressed(vk_f2)){
instance_destroy();
}
if(keyboard_check_pressed(vk_f3)){
popup_text_ext(string(oControl.seed), 300);
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="7" enumb="68">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>
var type_event = ds_map_find_value(async_load, "type");
switch(type_event){
case network_type_data:
var _buffer = ds_map_find_value(async_load, "buffer");
show_debug_message(buffer_get_size(_buffer));
buffer_seek(_buffer, buffer_seek_start, 0);
msgid = buffer_read(_buffer, buffer_u8);
switch(msgid){
case 100:
var clientID = buffer_read(_buffer, buffer_u8);
var clientX = buffer_read(_buffer, buffer_s16);
var clientY = buffer_read(_buffer, buffer_s16);
var clientSprite = buffer_read(_buffer, buffer_s16);
var clientImage = buffer_read(_buffer, buffer_s16);
var clientRoom = buffer_read(_buffer, buffer_s16);
var findsocket = ds_list_find_index(roomList, clientID);
if(global.clientID != clientID){
if(findsocket &lt; 0){
if(clientRoom == room){
ds_list_add(roomList, clientID);
var arr;
arr[0] = clientID;
arr[1] = clientX;
arr[2] = clientY;
arr[3] = clientSprite;
arr[4] = clientImage;
arr[5] = clientRoom;
ds_list_add(roomListData, arr);
}
} else {
if(clientRoom != room){
var indexValue = ds_list_find_value(roomList, findsocket);
ds_list_delete(roomList, findsocket);
for(var i=0; i&lt;ds_list_size(roomListData); i++){
var arrList = roomListData[| i];
if(arrList[0] == indexValue){
ds_list_delete(roomListData, i);
}
}
}
}
}
drawUpdate = true;
break;
case 0:
global.clientID = buffer_read(_buffer, buffer_u8);
break;
case 1:
ds_grid_read(global.onlineReceived, strict_decompress(buffer_read(_buffer, buffer_string)));
global.receivedClientID = buffer_read(_buffer, buffer_u8);
if(global.receivedClientID == global.clientID){
global.receivedPacketIDs[| global.receivedPacketID] = buffer_read(_buffer, buffer_u32);
}
global.receivedPacketID++;
if(global.receivedClientID != global.clientID){
update_variables("disablesame");
update_variables("replaceglobalvars");
update_variables("updateprev");
alarm[0] = 30;
ds_grid_clear(global.onlineReceived, -1);
}
break;
case 2:
ds_grid_read(global.onlineReceived, strict_decompress(buffer_read(_buffer, buffer_string)));
global.receivedClientID = buffer_read(_buffer, buffer_u8);
update_variables("disablesame");
update_variables("updateprev");
//global.itemChanges = 0;
//global.metdeadChanges = 0;
//global.eventChanges = 0;
alarm[0] = 30;
ds_grid_clear(global.onlineReceived, -1);
break;
case 3:
queenHealth = buffer_read(_buffer, buffer_s16);
var clientID = buffer_read(_buffer, buffer_u8);
phase = buffer_read(_buffer, buffer_s8);
state = buffer_read(_buffer, buffer_s8);
if(clientID != global.clientID){
if(!is_undefined(oQueenHead.myhealth) &amp;&amp; !is_undefined(oQueen.phase)){
if(oQueen.phase == phase){
if(global.queenhealthPrev != queenHealth){
global.queenhealthPrev = queenHealth;
oQueenHead.myhealth = queenHealth;
}
}
if(global.queenphasePrev != phase){
global.queenphasePrev = phase;
}
} else if(is_undefined(oQueenHead.myhealth) &amp;&amp; is_undefined(oQueen.phase)){
queenHealthResetQueued = true;
alarm[1] = 5;
}
} else {
if(!is_undefined(oQueenHead.myhealth) &amp;&amp; !is_undefined(oQueen.phase)){
if(oQueen.phase == phase){
if(global.queenhealthPrev != queenHealth){
global.queenhealthPrev = queenHealth;
oQueenHead.myhealth = queenHealth;
}
}
if(global.queenphasePrev != phase){
global.queenphasePrev = phase;
}
}
}
break;
case 4:
var _seed = buffer_read(_buffer, buffer_f64);
var clientID = buffer_read(_buffer, buffer_u8);
if(clientID != global.clientID){
if(seed != _seed){
seed = _seed;
show_debug_message("seed received");
popup_text("Seed received");
}
}
break;
case 5:
var monstersLeft = buffer_read(_buffer, buffer_s8);
var clientID = buffer_read(_buffer, buffer_u8);
show_debug_message("metroidsleft received " + string(monstersLeft));
if(global.clientID != clientID &amp;&amp; global.monstersleft != monstersLeft){
global.monstersleft = monstersLeft;
global.monstersleftPrev = global.monstersleft;
} else if(global.clientID == clientID){
global.monstersleftPrev = global.monstersleft;
}
alarm[2] = 30;
break;
case 6:
var monstersArea = buffer_read(_buffer, buffer_s8);
var clientID = buffer_read(_buffer, buffer_u8);
show_debug_message("metroidsarea received " + string(monstersArea));
if(global.clientID != clientID &amp;&amp; global.monstersarea != monstersArea){
global.monstersarea = monstersArea;
global.monstersareaPrev = global.monstersarea;
} else if(global.clientID == clientID){
global.monstersareaPrev = global.monstersarea;
}
alarm[2] = 30;
break;
case 7:
var item = ds_grid_create(1, 1);
ds_grid_read(item, strict_decompress(buffer_read(_buffer, buffer_string)));
var clientID = buffer_read(_buffer, buffer_u8);
var itemArr = item[# 0, 0];
show_debug_message(itemArr);
if(is_array(itemArr)){
for(var i=0; i&lt;array_length_1d(global.item); i++){
for(var f=0; f&lt;array_height_2d(itemArr); f++){
if(i == itemArr[f, 1]){
global.itemPrev[i] = itemArr[f, 0];
show_debug_message("item prev index " + string(i) + " changed");
if(global.item[i] != itemArr[f, 0]){
global.item[i] = itemArr[f, 0];
show_debug_message("item current index " + string(i) + " changed");
}
}
}
}
}
alarm[3] = 30;
if(global.clientID == clientID){
ds_grid_clear(global.onlineItem, -1);
global.itemChanges = 0;
}
ds_grid_destroy(item);
break;
case 8:
var metdead = ds_grid_create(1, 1);
ds_grid_read(metdead, strict_decompress(buffer_read(_buffer, buffer_string)));
var clientID = buffer_read(_buffer, buffer_u8);
var metdeadArr = metdead[# 0, 0];
show_debug_message(metdeadArr);
if(is_array(metdeadArr)){
for(var i=0; i&lt;array_length_1d(global.metdead); i++){
for(var f=0; f&lt;array_height_2d(metdeadArr); f++){
if(i == metdeadArr[f, 1]){
global.metdeadPrev[i] = metdeadArr[f, 0];
show_debug_message("metdead prev index " + string(i) + " changed");
if(global.metdead[i] != metdeadArr[f, 0]){
global.metdead[i] = metdeadArr[f, 0];
show_debug_message("metdead current index " + string(i) + " changed");
}
}
}
}
}
alarm[4] = 30;
if(global.clientID == clientID){
ds_grid_clear(global.onlineMetdead, -1);
global.metdeadChanges = 0;
}
ds_grid_destroy(metdead);
break;
case 9:
var event = ds_grid_create(1, 1);
ds_grid_read(event, strict_decompress(buffer_read(_buffer, buffer_string)));
var clientID = buffer_read(_buffer, buffer_u8);
var eventArr = event[# 0, 0];
show_debug_message(eventArr);
if(is_array(eventArr)){
for(var i=0; i&lt;array_length_1d(global.event); i++){
for(var f=0; f&lt;array_height_2d(eventArr); f++){
if(i == eventArr[f, 1]){
global.eventPrev[i] = eventArr[f, 0];
show_debug_message("event prev index " + string(i) + " changed");
if(global.event[i] != eventArr[f, 0]){
global.event[i] = eventArr[f, 0];
show_debug_message("event current index " + string(i) + " changed");
}
}
}
}
}
alarm[5] = 30;
if(global.clientID == clientID){
ds_grid_clear(global.onlineEvent, -1);
global.eventChanges = 0;
}
ds_grid_destroy(event);
break;
}
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="7" enumb="3">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>network_destroy(socket);
buffer_delete(buffer);
ds_grid_destroy(global.onlineList);
ds_grid_destroy(global.onlineSend);
ds_grid_destroy(global.onlineReceived);
//ds_grid_destroy(global.storedBuffers);
ds_grid_destroy(global.onlineItem);
ds_grid_destroy(global.onlineMetdead);
ds_grid_destroy(global.onlineEvent);
ds_list_destroy(global.receivedPacketIDs);
ds_list_destroy(roomList);
ds_list_destroy(roomListData);
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="8" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>if(ds_list_size(roomListData) &gt; 0){
for(var i=0; i&lt;ds_list_size(roomListData); i++){
var arrDraw = roomListData[| i];
var arrX = arrDraw[1];
var arrY = arrDraw[2];
var arrSprite = arrDraw[3];
var arrImage = arrDraw[4];
var arrRoom = arrDraw[5];
if(arrRoom == room &amp;&amp; instance_exists(oCharacter)){
draw_sprite_ext(arrSprite, arrImage, arrX, arrY, 1, 1, direction, c_black, image_alpha);
}
}
}
</string>
</argument>
</arguments>
</action>
</event>
</events>
<PhysicsObject>0</PhysicsObject>
<PhysicsObjectSensor>0</PhysicsObjectSensor>
<PhysicsObjectShape>0</PhysicsObjectShape>
<PhysicsObjectDensity>0.5</PhysicsObjectDensity>
<PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
<PhysicsObjectGroup>0</PhysicsObjectGroup>
<PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
<PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
<PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
<PhysicsObjectAwake>-1</PhysicsObjectAwake>
<PhysicsObjectKinematic>0</PhysicsObjectKinematic>
<PhysicsShapePoints/>
</object>