2022-07-10 07:48:13 -07:00
|
|
|
class VhtFnBool abstract {
|
|
|
|
virtual bool vhtRun() {return false;}
|
|
|
|
}
|
|
|
|
|
|
|
|
class VhtFnBoolFuse : VhtFnBool {
|
|
|
|
bool m_result;
|
|
|
|
VhtFnBool m_fInner;
|
|
|
|
VhtFnBoolFuse vhtInit(VhtFnBool fInner) {
|
|
|
|
m_fInner = fInner;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
override bool vhtRun() {
|
|
|
|
if(!m_result) {
|
|
|
|
m_result = m_fInner.vhtRun();
|
|
|
|
}
|
|
|
|
return m_result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class VhtFnPlayer : VhtFnBool abstract {
|
2022-07-10 06:24:30 -07:00
|
|
|
int m_player;
|
|
|
|
virtual bool vhtCall(PlayerInfo p) {return false;}
|
2022-07-10 07:48:13 -07:00
|
|
|
override bool vhtRun() {
|
2022-07-10 06:24:30 -07:00
|
|
|
for(int i = 0; i < MAXPLAYERS; ++i) {
|
|
|
|
if(playerInGame[i] && vhtCall(players[i])) {
|
|
|
|
m_player = i;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class VhtFnPlayerInSector : VhtFnPlayer {
|
|
|
|
int m_idx;
|
|
|
|
VhtFnPlayer vhtInit(int idx) {
|
|
|
|
m_idx = idx;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
override bool vhtCall(PlayerInfo p) {
|
|
|
|
return p.mo.curSector.index() == m_idx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class VhtFnPlayerInv : VhtFnPlayer abstract {
|
|
|
|
class<Inventory> m_which;
|
|
|
|
Inventory m_result;
|
|
|
|
override bool vhtCall(PlayerInfo p) {
|
|
|
|
let inv = p.mo.findInventory(m_which);
|
|
|
|
if(inv) {
|
|
|
|
m_result = inv;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class VhtFnPlayerInvExist : VhtFnPlayerInv {
|
|
|
|
VhtFnPlayerInv vhtInit(class<Inventory> which) {
|
|
|
|
m_which = which;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class VhtFnPlayerInvAmount : VhtFnPlayerInv {
|
|
|
|
int m_amount;
|
|
|
|
VhtFnPlayerInv vhtInit(class<Inventory> which, int amount) {
|
|
|
|
m_which = which;
|
|
|
|
m_amount = amount;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
override bool vhtCall(PlayerInfo p) {
|
|
|
|
return super.vhtCall(p) && m_result.amount >= m_amount;
|
|
|
|
}
|
|
|
|
}
|