Here is some code that I use for multiple doors opening with one click (ie large gates made of many in a row is one usage)
the idea is to point each door to the next door, and the last door back to the first in the 'triggerdoor' column of doors db (this way all the doors can open all the doors, other combos are possible) then you put in each door's triggertype column the total number of doors in the chain (this prevents an endless loop on this example)
works great on my server.
I apollogize now, as my line numbers in the code dont match up anymore with CVS. I included a lot of surrounding code and commented out what section I replaced.
../zone/client_process.cpp : line 5001 or thereabouts
Code:
int8 action = md->action;
entity_list.QueueClients(this,outapp,false);
delete outapp;
/*
if(currentdoor->GetTriggerDoorID() != 0)
{
Doors* triggerdoor = entity_list.FindDoor(currentdoor->GetTriggerDoorID());
if(triggerdoor)
{
if(!triggerdoor->IsDoorOpen())
{
triggerdoor->HandleClick(this);
//md->action = 0x02;
}
else
{
triggerdoor->HandleClick(this);
//md->action = 0x03;
}
outapp = new APPLAYER(OP_MoveDoor, sizeof(MoveDoor_Struct));
MoveDoor_Struct* md=(MoveDoor_Struct*)outapp->pBuffer;
md->doorid = triggerdoor->GetDoorID();
md->action = action;
entity_list.QueueClients(this,outapp,false);
delete outapp;
}
}
*/
//used_pawn
bool doorchain=false;
int8 chaincount=0;
int8 loopcount=1;
Doors* triggerdoor;
if(currentdoor->GetTriggerDoorID() != 0)
{
doorchain=true;
chaincount=currentdoor->GetTriggerType();
}
while(doorchain && (loopcount<=chaincount))
{
triggerdoor = entity_list.FindDoor(currentdoor->GetTriggerDoorID());
if(triggerdoor)
{
if(!triggerdoor->IsDoorOpen())
triggerdoor->HandleClick(this);
else
triggerdoor->HandleClick(this);
outapp = new APPLAYER(OP_MoveDoor, sizeof(MoveDoor_Struct));
MoveDoor_Struct* md=(MoveDoor_Struct*)outapp->pBuffer;
md->doorid = triggerdoor->GetDoorID();
md->action = action;
entity_list.QueueClients(this,outapp,false);
delete outapp;
}
loopcount++;
currentdoor=triggerdoor;
doorchain=false;
if(currentdoor->GetTriggerDoorID() != 0)
doorchain=true;
}
//used_pawn
break;
}
case OP_CreateObject: {
Here is an example of a long gate in qeynos pvp area. Watch your id values, yours may vary (mine I replaced some 'invisible plugs' (type 54) in qeynos)
Code:
INSERT INTO doors VALUES (821,57,'qeynos','PORT1414',105.1,-428.4,0.001,0,66,0,0,0,58,3,'0',0,0,0,0);
INSERT INTO doors VALUES (822,58,'qeynos','PORT1414',105.1,-440.9,0.001,0,66,0,0,0,59,3,'0',0,0,0,0);
INSERT INTO doors VALUES (823,59,'qeynos','PORT1414',105.1,-453.4,0.001,0,66,0,0,0,57,3,'0',0,0,0,0);
I used the 'triggertype' column on a whim because I couldnt figure out where it was used at all in the code (cept for the value 255).
I dunno if anyone thinks this is necessary to the project, but I didnt remember all long gates being separate pieces.
Enjoy!