]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/triggers/trigger/keylock.qh
A few trillion lines of untested junk, committing now so it doesn't become quadrillions
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / keylock.qh
1 #ifdef CSQC
2 void ent_keylock();
3 bool item_keys_usekey(entity l, entity p)
4 {
5         float valid = l.itemkeys & p.itemkeys;
6
7         if (!valid) {
8                 // other has none of the needed keys
9                 return false;
10         } else if (l.itemkeys == valid) {
11                 // ALL needed keys were given
12                 l.itemkeys = 0;
13                 return true;
14         } else {
15                 // only some of the needed keys were given
16                 l.itemkeys &= ~valid;
17                 return true;
18         }
19 }
20 #endif