I tried searching for this problem but haven't found an answer close to my problem.
Scope:
1) making a mech-style mod built using Darkplaces extensions.
2) players have entities attached to them as parts (using MOVETYPE_FOLLOW).
3) certain entities when killed, will kill the player ent (namely the mech's 'center torso').
4) player ent does not have a model, rather a pair of 'legs' are bolted onto the player at an offset.
Issue:
How do I handle player death? vanilla QC has the player state tightly coupled to the animation frames, but for my mod this is not the case.
I've been tearing my hair out trying to get respawning to work because the .deadflag logic is not being handled correctly.
Code: Select all
void() PlayerDie={
/*
normal code cribbed from player.qc
*/
if(self.p_class == P_MECH){
mech_player_die();
}
PlayerDead(); //this functions exactly as the original in player.qc
};
Code: Select all
void() mech_player_die={
local entity oself, w_chain, next;
oself = self;
mech_player_cameradie();
mech_player_compdie(self.e_tor_c);
mech_player_compdie(self.e_tor_l);
mech_player_compdie(self.e_tor_r);
mech_player_compdie(self.e_arm_l);
mech_player_compdie(self.e_arm_r);
mech_player_compdie(self.e_legs);
w_chain = self.w_slot;
while(w_chain){
mech_player_compdie(w_chain);
w_chain = w_chain.w_slot;
}
self = oself;
};
void(entity comp) mech_player_compdie={
if(comp.model){
if(comp != world && comp.owner == self){
local entity old;
old = self;
self = comp;
self.th_die();
self = old;
}
}
};