vht/vhtzs/fn.zsc
Alison Watson a22ae10d3b * move fnplayer to fn, making VhtFnPlayer into a VhtFnBool
* remove m_flags from VhtQuest
* add detection for flame mask
* add first step for quest 4
* don't serialize quest 1 step 2 line
* add null check for travelled/pretravelled
* move tick and describe functionality from events to questholder
* fix(?) multiplayer questholder move functionality
2022-07-10 08:48:13 -06:00

76 lines
1.5 KiB
Plaintext

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 {
int m_player;
virtual bool vhtCall(PlayerInfo p) {return false;}
override bool vhtRun() {
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;
}
}