Skip to main content

runec/
pointer.rs

1use std::collections::HashMap;
2use std::fmt;
3
4/// The pointer types tracked by the script pointer checker.
5///
6/// Each variant maps to a bit position in [`PointerSet`] and has a display
7/// name matching the reference TypeScript implementation.
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
9#[repr(u8)]
10pub enum PointerType {
11    ActivePlayer = 0,
12    ActivePlayer2 = 1,
13    PActivePlayer = 2,
14    PActivePlayer2 = 3,
15    ActiveNpc = 4,
16    ActiveNpc2 = 5,
17    ActiveLoc = 6,
18    ActiveLoc2 = 7,
19    ActiveObj = 8,
20    ActiveObj2 = 9,
21    FindPlayer = 10,
22    FindNpc = 11,
23    FindLoc = 12,
24    FindObj = 13,
25    FindDb = 14,
26    LastCom = 15,
27    LastInt = 16,
28    LastItem = 17,
29    LastSlot = 18,
30    LastTargetslot = 19,
31    LastUseitem = 20,
32    LastUseslot = 21,
33    ActiveComponent = 22,
34    ActiveComponent2 = 23,
35    ActiveController = 24,
36    ActiveController2 = 25,
37    ActiveRegion = 26,
38    ActiveRegion2 = 27,
39}
40
41impl PointerType {
42    pub const COUNT: usize = 28;
43
44    pub const ALL: [PointerType; Self::COUNT] = [
45        PointerType::ActivePlayer,
46        PointerType::ActivePlayer2,
47        PointerType::PActivePlayer,
48        PointerType::PActivePlayer2,
49        PointerType::ActiveNpc,
50        PointerType::ActiveNpc2,
51        PointerType::ActiveLoc,
52        PointerType::ActiveLoc2,
53        PointerType::ActiveObj,
54        PointerType::ActiveObj2,
55        PointerType::FindPlayer,
56        PointerType::FindNpc,
57        PointerType::FindLoc,
58        PointerType::FindObj,
59        PointerType::FindDb,
60        PointerType::LastCom,
61        PointerType::LastInt,
62        PointerType::LastItem,
63        PointerType::LastSlot,
64        PointerType::LastTargetslot,
65        PointerType::LastUseitem,
66        PointerType::LastUseslot,
67        PointerType::ActiveComponent,
68        PointerType::ActiveComponent2,
69        PointerType::ActiveController,
70        PointerType::ActiveController2,
71        PointerType::ActiveRegion,
72        PointerType::ActiveRegion2,
73    ];
74
75    /// The representation string used in diagnostics, matching the TS reference.
76    pub fn representation(self) -> &'static str {
77        match self {
78            PointerType::ActivePlayer => "active_player",
79            PointerType::ActivePlayer2 => ".active_player",
80            PointerType::PActivePlayer => "p_active_player",
81            PointerType::PActivePlayer2 => ".p_active_player",
82            PointerType::ActiveNpc => "active_npc",
83            PointerType::ActiveNpc2 => ".active_npc",
84            PointerType::ActiveLoc => "active_loc",
85            PointerType::ActiveLoc2 => ".active_loc",
86            PointerType::ActiveObj => "active_obj",
87            PointerType::ActiveObj2 => ".active_obj",
88            PointerType::FindPlayer => "find_player",
89            PointerType::FindNpc => "find_npc",
90            PointerType::FindLoc => "find_loc",
91            PointerType::FindObj => "find_obj",
92            PointerType::FindDb => "find_db",
93            PointerType::LastCom => "last_com",
94            PointerType::LastInt => "last_int",
95            PointerType::LastItem => "last_item",
96            PointerType::LastSlot => "last_slot",
97            PointerType::LastTargetslot => "last_targetslot",
98            PointerType::LastUseitem => "last_useitem",
99            PointerType::LastUseslot => "last_useslot",
100            PointerType::ActiveComponent => "active_component",
101            PointerType::ActiveComponent2 => ".active_component",
102            PointerType::ActiveController => "active_controller",
103            PointerType::ActiveController2 => ".active_controller",
104            PointerType::ActiveRegion => "active_region",
105            PointerType::ActiveRegion2 => ".active_region",
106        }
107    }
108
109    pub fn index(self) -> usize {
110        self as usize
111    }
112
113    /// Look up a pointer type by its lowercase name (e.g. "active_player",
114    /// ".active_player", "p_active_player").
115    pub fn from_name(name: &str) -> Option<PointerType> {
116        let lower = name.to_lowercase();
117        Self::ALL
118            .iter()
119            .find(|&&ptr| ptr.representation() == lower)
120            .copied()
121    }
122}
123
124impl fmt::Display for PointerType {
125    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
126        f.write_str(self.representation())
127    }
128}
129
130// ---------------------------------------------------------------------------
131// PointerSet: bitmask for efficient pointer set operations
132// ---------------------------------------------------------------------------
133
134#[derive(Clone, Copy, Default, PartialEq, Eq, Debug)]
135pub struct PointerSet(u32);
136
137impl PointerSet {
138    pub fn new() -> Self {
139        PointerSet(0)
140    }
141
142    /// A set containing every pointer type.
143    pub fn all() -> Self {
144        PointerSet((1u32 << PointerType::COUNT) - 1)
145    }
146
147    pub fn insert(&mut self, ptr: PointerType) {
148        self.0 |= 1u32 << ptr.index();
149    }
150
151    pub fn remove(&mut self, ptr: PointerType) {
152        self.0 &= !(1u32 << ptr.index());
153    }
154
155    pub fn contains(self, ptr: PointerType) -> bool {
156        (self.0 & (1u32 << ptr.index())) != 0
157    }
158
159    pub fn union(self, other: PointerSet) -> PointerSet {
160        PointerSet(self.0 | other.0)
161    }
162
163    pub fn is_empty(self) -> bool {
164        self.0 == 0
165    }
166
167    pub fn iter(self) -> PointerSetIter {
168        PointerSetIter { bits: self.0 }
169    }
170}
171
172pub struct PointerSetIter {
173    bits: u32,
174}
175
176impl Iterator for PointerSetIter {
177    type Item = PointerType;
178
179    fn next(&mut self) -> Option<Self::Item> {
180        if self.bits == 0 {
181            return None;
182        }
183        let idx = self.bits.trailing_zeros() as usize;
184        self.bits &= self.bits - 1; // clear lowest bit
185        if idx < PointerType::COUNT {
186            Some(PointerType::ALL[idx])
187        } else {
188            None
189        }
190    }
191}
192
193impl FromIterator<PointerType> for PointerSet {
194    fn from_iter<T: IntoIterator<Item = PointerType>>(iter: T) -> Self {
195        let mut set = PointerSet::new();
196        for ptr in iter {
197            set.insert(ptr);
198        }
199        set
200    }
201}
202
203// ---------------------------------------------------------------------------
204// PointerHolder — describes a command's pointer requirements
205// ---------------------------------------------------------------------------
206
207#[derive(Clone, Debug, Default)]
208pub struct PointerHolder {
209    pub required: PointerSet,
210    pub set: PointerSet,
211    pub conditional_set: bool,
212    pub corrupted: PointerSet,
213}
214
215// ---------------------------------------------------------------------------
216// trigger_pointers — which pointers a trigger type initializes
217// ---------------------------------------------------------------------------
218
219/// Returns the set of pointers that are initialized when a script with the
220/// given trigger type begins execution. Matches `ServerTriggerType.ts`.
221pub fn trigger_pointers(trigger: &str) -> PointerSet {
222    use PointerType::*;
223
224    let ptrs: &[PointerType] = match trigger {
225        // proc and label get ALL pointers (they inherit from caller)
226        "proc" | "label" => return PointerSet::all(),
227
228        // debugproc gets only active_player (console command context)
229        "debugproc" => &[ActivePlayer],
230
231        // Player-NPC approach/operate triggers
232        "apnpc1" | "apnpc2" | "apnpc3" | "apnpc4" | "apnpc5" => {
233            &[ActivePlayer, PActivePlayer, ActiveNpc]
234        }
235        "apnpcu" => &[
236            ActivePlayer,
237            PActivePlayer,
238            LastUseitem,
239            LastUseslot,
240            ActiveNpc,
241        ],
242        "apnpct" => &[ActivePlayer, PActivePlayer, ActiveNpc],
243        "opnpc1" | "opnpc2" | "opnpc3" | "opnpc4" | "opnpc5" => {
244            &[ActivePlayer, PActivePlayer, ActiveNpc]
245        }
246        "opnpcu" => &[
247            ActivePlayer,
248            PActivePlayer,
249            LastUseitem,
250            LastUseslot,
251            ActiveNpc,
252        ],
253        "opnpct" => &[ActivePlayer, PActivePlayer, ActiveNpc],
254
255        // AI NPC triggers (NPC vs NPC)
256        "ai_apnpc1" | "ai_apnpc2" | "ai_apnpc3" | "ai_apnpc4" | "ai_apnpc5" => {
257            &[ActiveNpc, ActiveNpc2]
258        }
259        "ai_opnpc1" | "ai_opnpc2" | "ai_opnpc3" | "ai_opnpc4" | "ai_opnpc5" => {
260            &[ActiveNpc, ActiveNpc2]
261        }
262
263        // Player-Obj approach/operate triggers
264        "apobj1" | "apobj2" | "apobj3" | "apobj4" | "apobj5" => {
265            &[ActivePlayer, PActivePlayer, ActiveObj]
266        }
267        "apobju" => &[
268            ActivePlayer,
269            PActivePlayer,
270            LastUseitem,
271            LastUseslot,
272            ActiveObj,
273        ],
274        "apobjt" => &[ActivePlayer, PActivePlayer, ActiveObj],
275        "opobj1" | "opobj2" | "opobj3" | "opobj4" | "opobj5" => {
276            &[ActivePlayer, PActivePlayer, ActiveObj]
277        }
278        "opobju" => &[
279            ActivePlayer,
280            PActivePlayer,
281            LastUseitem,
282            LastUseslot,
283            ActiveObj,
284        ],
285        "opobjt" => &[ActivePlayer, PActivePlayer, ActiveObj],
286
287        // AI Obj triggers (NPC vs obj)
288        "ai_apobj1" | "ai_apobj2" | "ai_apobj3" | "ai_apobj4" | "ai_apobj5" => {
289            &[ActiveNpc, ActiveObj]
290        }
291        "ai_opobj1" | "ai_opobj2" | "ai_opobj3" | "ai_opobj4" | "ai_opobj5" => {
292            &[ActiveNpc, ActiveObj]
293        }
294
295        // Player-Loc approach/operate triggers
296        "aploc1" | "aploc2" | "aploc3" | "aploc4" | "aploc5" => {
297            &[ActivePlayer, PActivePlayer, ActiveLoc]
298        }
299        "aplocu" => &[
300            ActivePlayer,
301            PActivePlayer,
302            LastUseitem,
303            LastUseslot,
304            ActiveLoc,
305        ],
306        "aploct" => &[ActivePlayer, PActivePlayer, ActiveLoc],
307        "oploc1" | "oploc2" | "oploc3" | "oploc4" | "oploc5" => {
308            &[ActivePlayer, PActivePlayer, ActiveLoc]
309        }
310        "oplocu" => &[
311            ActivePlayer,
312            PActivePlayer,
313            LastUseitem,
314            LastUseslot,
315            ActiveLoc,
316        ],
317        "oploct" => &[ActivePlayer, PActivePlayer, ActiveLoc],
318
319        // AI Loc triggers (NPC vs loc)
320        "ai_aploc1" | "ai_aploc2" | "ai_aploc3" | "ai_aploc4" | "ai_aploc5" => {
321            &[ActiveNpc, ActiveLoc]
322        }
323        "ai_oploc1" | "ai_oploc2" | "ai_oploc3" | "ai_oploc4" | "ai_oploc5" => {
324            &[ActiveNpc, ActiveLoc]
325        }
326
327        // Player-Player approach/operate triggers
328        "applayer1" | "applayer2" | "applayer3" | "applayer4" | "applayer5" => {
329            &[ActivePlayer, PActivePlayer, ActivePlayer2]
330        }
331        "applayeru" => &[
332            ActivePlayer,
333            PActivePlayer,
334            LastUseitem,
335            LastUseslot,
336            ActivePlayer2,
337        ],
338        "applayert" => &[ActivePlayer, PActivePlayer, ActivePlayer2],
339        "opplayer1" | "opplayer2" | "opplayer3" | "opplayer4" | "opplayer5" => {
340            &[ActivePlayer, PActivePlayer, ActivePlayer2]
341        }
342        "opplayeru" => &[
343            ActivePlayer,
344            PActivePlayer,
345            LastUseitem,
346            LastUseslot,
347            ActivePlayer2,
348        ],
349        "opplayert" => &[ActivePlayer, PActivePlayer, ActivePlayer2],
350
351        // AI Player triggers (NPC vs player)
352        "ai_applayer1" | "ai_applayer2" | "ai_applayer3" | "ai_applayer4" | "ai_applayer5" => {
353            &[ActiveNpc, ActivePlayer]
354        }
355        "ai_opplayer1" | "ai_opplayer2" | "ai_opplayer3" | "ai_opplayer4" | "ai_opplayer5" => {
356            &[ActiveNpc, ActivePlayer]
357        }
358
359        // Queue trigger
360        "queue" => &[ActivePlayer, PActivePlayer],
361
362        // AI queue triggers
363        "ai_queue1" | "ai_queue2" | "ai_queue3" | "ai_queue4" | "ai_queue5" | "ai_queue6"
364        | "ai_queue7" | "ai_queue8" | "ai_queue9" | "ai_queue10" | "ai_queue11" | "ai_queue12"
365        | "ai_queue13" | "ai_queue14" | "ai_queue15" | "ai_queue16" | "ai_queue17"
366        | "ai_queue18" | "ai_queue19" | "ai_queue20" => &[ActiveNpc, LastInt],
367
368        // Soft timer (player context only)
369        "softtimer" => &[ActivePlayer],
370
371        // Timer (player + protected)
372        "timer" => &[ActivePlayer, PActivePlayer],
373
374        // AI timer (NPC context)
375        "ai_timer" => &[ActiveNpc],
376
377        // Held item triggers
378        "opheld1" | "opheld2" | "opheld3" | "opheld4" | "opheld5" => {
379            &[ActivePlayer, PActivePlayer, LastItem, LastSlot]
380        }
381        "opheldu" => &[
382            ActivePlayer,
383            PActivePlayer,
384            LastItem,
385            LastSlot,
386            LastUseitem,
387            LastUseslot,
388        ],
389        "opheldt" => &[ActivePlayer, PActivePlayer, LastItem, LastSlot],
390
391        // Interface button trigger
392        "if_button" => &[ActivePlayer, LastCom],
393
394        // Interface close trigger
395        "if_close" => &[ActivePlayer],
396
397        // Inventory button triggers
398        "inv_button1" | "inv_button2" | "inv_button3" | "inv_button4" | "inv_button5" => {
399            &[ActivePlayer, LastItem, LastSlot]
400        }
401        // Also accept if_button1..5 aliases
402        "if_button1" | "if_button2" | "if_button3" | "if_button4" | "if_button5" => {
403            &[ActivePlayer, LastItem, LastSlot]
404        }
405        "inv_buttond" | "if_buttond" => &[ActivePlayer, LastSlot, LastTargetslot],
406        // Rev-647: inventory item ops 6-10. Only the if_button spelling extends
407        // to 6-10 (inv_button is the 225 family, capped at 5). Content uses these
408        // + the `p_opheld(op, inv, slot)` command.
409        "if_button6" | "if_button7" | "if_button8" | "if_button9" | "if_button10" => {
410            &[ActivePlayer, LastItem, LastSlot]
411        }
412
413        // Walk trigger
414        "walktrigger" => &[ActivePlayer, PActivePlayer],
415
416        // Global triggers
417        "login" | "logout" | "tutorial" | "switch_window_mode" => &[ActivePlayer, PActivePlayer],
418        "advancestat" | "changestat" => &[ActivePlayer, PActivePlayer],
419        "mapzone" | "mapzoneexit" | "zone" | "zoneexit" => &[ActivePlayer, PActivePlayer],
420        "area" | "areaexit" => &[ActivePlayer, PActivePlayer],
421
422        // AI lifecycle triggers
423        "ai_spawn" | "ai_despawn" => &[ActiveNpc],
424
425        // AI walktrigger
426        "ai_walktrigger" => &[ActiveNpc],
427
428        // A controller is an npc with no body: one queue (its int in last_int)
429        // and a timer.
430        "ai_conqueue" => &[ActiveController, LastInt],
431        "ai_contimer" => &[ActiveController],
432        // `controller_queue*` runs a named one with its own args.
433        "controller_queue" => &[ActiveController],
434        // `npc_queue*` runs a named one with its own args.
435        "npc_queue" => &[ActiveNpc],
436
437        // Unknown trigger — no pointers initialized
438        _ => return PointerSet::new(),
439    };
440
441    ptrs.iter().copied().collect()
442}
443
444// ---------------------------------------------------------------------------
445// command_pointers — pointer requirements for every engine command
446// ---------------------------------------------------------------------------
447
448/// Builds the full mapping from command name to its pointer requirements.
449///
450/// Both primary and secondary (`.` prefixed) variants are generated as
451/// separate entries. The keys use lowercase command names matching the
452/// SymbolRegistry command map.
453///
454/// Transcribed from `ScriptOpcodePointers.ts`.
455pub fn command_pointers() -> HashMap<String, PointerHolder> {
456    use PointerType::*;
457
458    let mut map = HashMap::new();
459
460    // Helper closures to reduce boilerplate
461    let mut add = |name: &str,
462                   require: &[PointerType],
463                   set: &[PointerType],
464                   corrupt: &[PointerType],
465                   require2: &[PointerType],
466                   set2: &[PointerType],
467                   corrupt2: &[PointerType],
468                   conditional: bool| {
469        // Primary entry
470        let holder = PointerHolder {
471            required: require.iter().copied().collect(),
472            set: set.iter().copied().collect(),
473            corrupted: corrupt.iter().copied().collect(),
474            conditional_set: conditional,
475        };
476        map.insert(name.to_lowercase(), holder);
477
478        // Secondary entry (dot-prefixed) if any require2/set2/corrupt2 are specified
479        if !require2.is_empty() || !set2.is_empty() || !corrupt2.is_empty() {
480            let holder2 = PointerHolder {
481                required: require2.iter().copied().collect(),
482                set: set2.iter().copied().collect(),
483                corrupted: corrupt2.iter().copied().collect(),
484                conditional_set: conditional,
485            };
486            map.insert(format!(".{}", name.to_lowercase()), holder2);
487        }
488    };
489
490    // The POINTER_GROUP_FIND shorthand
491    let find_group: &[PointerType] = &[FindPlayer, FindNpc, FindLoc, FindObj, FindDb];
492    // Corruption set for p_delay / p_arrivedelay style commands:
493    // everything except active is assumed corrupted
494    let delay_corrupt: Vec<PointerType> = {
495        let mut v: Vec<PointerType> = find_group.to_vec();
496        v.extend_from_slice(&[
497            LastCom,
498            LastInt,
499            LastItem,
500            LastSlot,
501            LastTargetslot,
502            LastUseitem,
503            LastUseslot,
504        ]);
505        v
506    };
507
508    // -----------------------------------------------------------------------
509    // Player ops
510    // -----------------------------------------------------------------------
511    add(
512        "allowdesign",
513        &[ActivePlayer],
514        &[],
515        &[],
516        &[],
517        &[],
518        &[],
519        false,
520    );
521    add(
522        "anim",
523        &[ActivePlayer],
524        &[],
525        &[],
526        &[ActivePlayer2],
527        &[],
528        &[],
529        false,
530    );
531    add(
532        "readyanim",
533        &[ActivePlayer],
534        &[],
535        &[],
536        &[ActivePlayer2],
537        &[],
538        &[],
539        false,
540    );
541    add(
542        "runanim",
543        &[ActivePlayer],
544        &[],
545        &[],
546        &[ActivePlayer2],
547        &[],
548        &[],
549        false,
550    );
551    add(
552        "turnanim",
553        &[ActivePlayer],
554        &[],
555        &[],
556        &[ActivePlayer2],
557        &[],
558        &[],
559        false,
560    );
561    add(
562        "walkanim_b",
563        &[ActivePlayer],
564        &[],
565        &[],
566        &[ActivePlayer2],
567        &[],
568        &[],
569        false,
570    );
571    add(
572        "walkanim",
573        &[ActivePlayer],
574        &[],
575        &[],
576        &[ActivePlayer2],
577        &[],
578        &[],
579        false,
580    );
581    add(
582        "walkanim_l",
583        &[ActivePlayer],
584        &[],
585        &[],
586        &[ActivePlayer2],
587        &[],
588        &[],
589        false,
590    );
591    add(
592        "walkanim_r",
593        &[ActivePlayer],
594        &[],
595        &[],
596        &[ActivePlayer2],
597        &[],
598        &[],
599        false,
600    );
601    add(
602        "buildappearance",
603        &[ActivePlayer],
604        &[],
605        &[],
606        &[ActivePlayer2],
607        &[],
608        &[],
609        false,
610    );
611    add(
612        "busy",
613        &[ActivePlayer],
614        &[],
615        &[],
616        &[ActivePlayer2],
617        &[],
618        &[],
619        false,
620    );
621    add(
622        "busy2",
623        &[ActivePlayer],
624        &[],
625        &[],
626        &[ActivePlayer2],
627        &[],
628        &[],
629        false,
630    );
631    add(
632        "cam_lookat",
633        &[ActivePlayer],
634        &[],
635        &[],
636        &[ActivePlayer2],
637        &[],
638        &[],
639        false,
640    );
641    add(
642        "cam_moveto",
643        &[ActivePlayer],
644        &[],
645        &[],
646        &[ActivePlayer2],
647        &[],
648        &[],
649        false,
650    );
651    add(
652        "cam_reset",
653        &[ActivePlayer],
654        &[],
655        &[],
656        &[ActivePlayer2],
657        &[],
658        &[],
659        false,
660    );
661    add(
662        "cam_shake",
663        &[ActivePlayer],
664        &[],
665        &[],
666        &[ActivePlayer2],
667        &[],
668        &[],
669        false,
670    );
671    add(
672        "clearqueue",
673        &[ActivePlayer],
674        &[],
675        &[],
676        &[ActivePlayer2],
677        &[],
678        &[],
679        false,
680    );
681    add(
682        "clearsofttimer",
683        &[ActivePlayer],
684        &[],
685        &[],
686        &[ActivePlayer2],
687        &[],
688        &[],
689        false,
690    );
691    add(
692        "cleartimer",
693        &[ActivePlayer],
694        &[],
695        &[],
696        &[ActivePlayer2],
697        &[],
698        &[],
699        false,
700    );
701    add(
702        "gettimer",
703        &[ActivePlayer],
704        &[],
705        &[],
706        &[ActivePlayer2],
707        &[],
708        &[],
709        false,
710    );
711    add(
712        "coord",
713        &[ActivePlayer],
714        &[],
715        &[],
716        &[ActivePlayer2],
717        &[],
718        &[],
719        false,
720    );
721    add(
722        "damage",
723        &[ActivePlayer],
724        &[],
725        &[],
726        &[ActivePlayer2],
727        &[],
728        &[],
729        false,
730    );
731    add(
732        "displayname",
733        &[ActivePlayer],
734        &[],
735        &[],
736        &[ActivePlayer2],
737        &[],
738        &[],
739        false,
740    );
741    add(
742        "facesquare",
743        &[ActivePlayer],
744        &[],
745        &[],
746        &[ActivePlayer2],
747        &[],
748        &[],
749        false,
750    );
751    add(
752        "finduid",
753        &[],
754        &[ActivePlayer],
755        &[PActivePlayer],
756        &[],
757        &[ActivePlayer2],
758        &[PActivePlayer2],
759        true,
760    );
761    add(
762        "gender",
763        &[ActivePlayer],
764        &[],
765        &[],
766        &[ActivePlayer2],
767        &[],
768        &[],
769        false,
770    );
771    add(
772        "getqueue",
773        &[ActivePlayer],
774        &[],
775        &[],
776        &[ActivePlayer2],
777        &[],
778        &[],
779        false,
780    );
781    add(
782        "stat_advance",
783        &[ActivePlayer],
784        &[],
785        &[],
786        &[],
787        &[],
788        &[],
789        false,
790    );
791    add(
792        "headicons_get",
793        &[ActivePlayer],
794        &[],
795        &[],
796        &[ActivePlayer2],
797        &[],
798        &[],
799        false,
800    );
801    add(
802        "headicons_set",
803        &[ActivePlayer],
804        &[],
805        &[],
806        &[ActivePlayer2],
807        &[],
808        &[],
809        false,
810    );
811    add(
812        "healenergy",
813        &[ActivePlayer],
814        &[],
815        &[],
816        &[ActivePlayer2],
817        &[],
818        &[],
819        false,
820    );
821    add(
822        "hint_coord",
823        &[ActivePlayer],
824        &[],
825        &[],
826        &[],
827        &[],
828        &[],
829        false,
830    );
831    add(
832        "hint_npc",
833        &[ActivePlayer, ActiveNpc],
834        &[],
835        &[],
836        &[],
837        &[],
838        &[],
839        false,
840    );
841    add(
842        "hint_pl",
843        &[ActivePlayer, ActivePlayer2],
844        &[],
845        &[],
846        &[ActivePlayer2, ActivePlayer],
847        &[],
848        &[],
849        false,
850    );
851    add(
852        "hint_stop",
853        &[ActivePlayer],
854        &[],
855        &[],
856        &[ActivePlayer2],
857        &[],
858        &[],
859        false,
860    );
861    add("huntall", &[], &[FindPlayer], &[], &[], &[], &[], false);
862    add(
863        "huntnext",
864        &[FindPlayer],
865        &[ActivePlayer],
866        &[],
867        &[FindPlayer],
868        &[ActivePlayer2],
869        &[],
870        true,
871    );
872    add(
873        "npc_hunt",
874        &[],
875        &[ActiveNpc],
876        &[],
877        &[],
878        &[ActiveNpc2],
879        &[],
880        false,
881    );
882    add("npc_huntall", &[], &[FindNpc], &[], &[], &[], &[], false);
883    add(
884        "npc_hasop",
885        &[ActiveNpc],
886        &[],
887        &[],
888        &[ActiveNpc2],
889        &[],
890        &[],
891        false,
892    );
893    add(
894        "if_close",
895        &[ActivePlayer],
896        &[],
897        &[],
898        &[ActivePlayer2],
899        &[],
900        &[],
901        false,
902    );
903    add("tut_close", &[ActivePlayer], &[], &[], &[], &[], &[], false);
904    add(
905        "if_openchat",
906        &[ActivePlayer],
907        &[],
908        &[],
909        &[ActivePlayer2],
910        &[],
911        &[],
912        false,
913    );
914    add("tut_open", &[ActivePlayer], &[], &[], &[], &[], &[], false);
915    // 2004scape (rev 225) names this command `if_openmain`. Rev 647 renamed it
916    // to `if_opentop` (since `if_openmain` is reserved for opening a modal in
917    // the main viewport). Both names get the same pointer rules so the compiler
918    // accepts content from either revision.
919    add(
920        "if_openmain",
921        &[ActivePlayer],
922        &[],
923        &[],
924        &[ActivePlayer2],
925        &[],
926        &[],
927        false,
928    );
929    add(
930        "if_opentop",
931        &[ActivePlayer],
932        &[],
933        &[],
934        &[ActivePlayer2],
935        &[],
936        &[],
937        false,
938    );
939    add(
940        "if_openmain_side",
941        &[ActivePlayer],
942        &[],
943        &[],
944        &[ActivePlayer2],
945        &[],
946        &[],
947        false,
948    );
949    add(
950        "if_openoverlay",
951        &[ActivePlayer],
952        &[],
953        &[],
954        &[ActivePlayer2],
955        &[],
956        &[],
957        false,
958    );
959    add(
960        "if_openside",
961        &[ActivePlayer],
962        &[],
963        &[],
964        &[],
965        &[],
966        &[],
967        false,
968    );
969    add(
970        "if_setanim",
971        &[ActivePlayer],
972        &[],
973        &[],
974        &[ActivePlayer2],
975        &[],
976        &[],
977        false,
978    );
979    add(
980        "if_setcolour",
981        &[ActivePlayer],
982        &[],
983        &[],
984        &[],
985        &[],
986        &[],
987        false,
988    );
989    add(
990        "if_sethide",
991        &[ActivePlayer],
992        &[],
993        &[],
994        &[ActivePlayer2],
995        &[],
996        &[],
997        false,
998    );
999    add(
1000        "if_setmodel",
1001        &[ActivePlayer],
1002        &[],
1003        &[],
1004        &[],
1005        &[],
1006        &[],
1007        false,
1008    );
1009    add(
1010        "if_setnpchead",
1011        &[ActivePlayer],
1012        &[],
1013        &[],
1014        &[],
1015        &[],
1016        &[],
1017        false,
1018    );
1019    add(
1020        "if_setobject",
1021        &[ActivePlayer],
1022        &[],
1023        &[],
1024        &[ActivePlayer2],
1025        &[],
1026        &[],
1027        false,
1028    );
1029    add(
1030        "if_setplayerhead",
1031        &[ActivePlayer],
1032        &[],
1033        &[],
1034        &[],
1035        &[],
1036        &[],
1037        false,
1038    );
1039    add(
1040        "if_setposition",
1041        &[ActivePlayer],
1042        &[],
1043        &[],
1044        &[ActivePlayer2],
1045        &[],
1046        &[],
1047        false,
1048    );
1049    add(
1050        "if_addresumebutton",
1051        &[ActivePlayer],
1052        &[],
1053        &[],
1054        &[],
1055        &[],
1056        &[],
1057        false,
1058    );
1059    add(
1060        "if_settab",
1061        &[ActivePlayer],
1062        &[],
1063        &[],
1064        &[ActivePlayer2],
1065        &[],
1066        &[],
1067        false,
1068    );
1069    add(
1070        "if_settabactive",
1071        &[ActivePlayer],
1072        &[],
1073        &[],
1074        &[ActivePlayer2],
1075        &[],
1076        &[],
1077        false,
1078    );
1079    add("tut_flash", &[ActivePlayer], &[], &[], &[], &[], &[], false);
1080    add(
1081        "if_settext",
1082        &[ActivePlayer],
1083        &[],
1084        &[],
1085        &[ActivePlayer2],
1086        &[],
1087        &[],
1088        false,
1089    );
1090    add(
1091        "last_login_info",
1092        &[ActivePlayer],
1093        &[],
1094        &[],
1095        &[],
1096        &[],
1097        &[],
1098        false,
1099    );
1100    add("last_com", &[LastCom], &[], &[], &[], &[], &[], false);
1101    add("last_int", &[LastInt], &[], &[], &[], &[], &[], false);
1102    add("last_item", &[LastItem], &[], &[], &[], &[], &[], false);
1103    add("last_slot", &[LastSlot], &[], &[], &[], &[], &[], false);
1104    add(
1105        "last_targetslot",
1106        &[LastTargetslot],
1107        &[],
1108        &[],
1109        &[],
1110        &[],
1111        &[],
1112        false,
1113    );
1114    add(
1115        "last_useitem",
1116        &[LastUseitem],
1117        &[],
1118        &[],
1119        &[],
1120        &[],
1121        &[],
1122        false,
1123    );
1124    add(
1125        "last_useslot",
1126        &[LastUseslot],
1127        &[],
1128        &[],
1129        &[],
1130        &[],
1131        &[],
1132        false,
1133    );
1134    add(
1135        "longqueue",
1136        &[ActivePlayer],
1137        &[],
1138        &[],
1139        &[ActivePlayer2],
1140        &[],
1141        &[],
1142        false,
1143    );
1144    add(
1145        "longqueue*",
1146        &[ActivePlayer],
1147        &[],
1148        &[],
1149        &[ActivePlayer2],
1150        &[],
1151        &[],
1152        false,
1153    );
1154    add("lowmem", &[ActivePlayer], &[], &[], &[], &[], &[], false);
1155    add(
1156        "mes",
1157        &[ActivePlayer],
1158        &[],
1159        &[],
1160        &[ActivePlayer2],
1161        &[],
1162        &[],
1163        false,
1164    );
1165    add(
1166        "midi_jingle",
1167        &[ActivePlayer],
1168        &[],
1169        &[],
1170        &[ActivePlayer2],
1171        &[],
1172        &[],
1173        false,
1174    );
1175    add("midi_song", &[ActivePlayer], &[], &[], &[], &[], &[], false);
1176    add(
1177        "minimap_toggle",
1178        &[ActivePlayer],
1179        &[],
1180        &[],
1181        &[ActivePlayer2],
1182        &[],
1183        &[],
1184        false,
1185    );
1186    add(
1187        "name",
1188        &[ActivePlayer],
1189        &[],
1190        &[],
1191        &[ActivePlayer2],
1192        &[],
1193        &[],
1194        false,
1195    );
1196    add(
1197        "p_aprange",
1198        &[PActivePlayer],
1199        &[],
1200        &[],
1201        &[],
1202        &[],
1203        &[],
1204        false,
1205    );
1206    add(
1207        "p_arrivedelay",
1208        &[PActivePlayer],
1209        &[],
1210        &delay_corrupt,
1211        &[],
1212        &[],
1213        &[],
1214        false,
1215    );
1216    {
1217        // p_countdialog: sets last_int, corrupts everything except active + last_int
1218        let mut corrupt = delay_corrupt.clone();
1219        corrupt.retain(|p| *p != LastInt);
1220        add(
1221            "p_countdialog",
1222            &[PActivePlayer],
1223            &[LastInt],
1224            &corrupt,
1225            &[],
1226            &[],
1227            &[],
1228            false,
1229        );
1230    }
1231    add(
1232        "p_delay",
1233        &[PActivePlayer],
1234        &[],
1235        &delay_corrupt,
1236        &[PActivePlayer2],
1237        &[],
1238        &delay_corrupt,
1239        false,
1240    );
1241    add(
1242        "p_exactmove",
1243        &[PActivePlayer],
1244        &[],
1245        &[],
1246        &[],
1247        &[],
1248        &[],
1249        false,
1250    );
1251    for name in [
1252        "p_namedialog",
1253        "p_stringdialog",
1254        "p_setdisplayname",
1255        "p_get_suggestion",
1256        "p_next_suggestions",
1257        "p_prev_suggestions",
1258        "p_request_more_suggestions",
1259        "p_rest",
1260        "p_temprun",
1261    ] {
1262        add(name, &[PActivePlayer], &[], &[], &[], &[], &[], false);
1263    }
1264    add(
1265        "p_finduid",
1266        &[],
1267        &[PActivePlayer, ActivePlayer],
1268        &[],
1269        &[],
1270        &[PActivePlayer2, ActivePlayer2],
1271        &[],
1272        true,
1273    );
1274    add(
1275        "p_locmerge",
1276        &[PActivePlayer],
1277        &[],
1278        &[],
1279        &[],
1280        &[],
1281        &[],
1282        false,
1283    );
1284    add("p_logout", &[PActivePlayer], &[], &[], &[], &[], &[], false);
1285    add(
1286        "p_preventlogout",
1287        &[PActivePlayer],
1288        &[],
1289        &[],
1290        &[PActivePlayer2],
1291        &[],
1292        &[],
1293        false,
1294    );
1295    add("p_opheld", &[PActivePlayer], &[], &[], &[], &[], &[], false);
1296    add(
1297        "p_oploc",
1298        &[PActivePlayer, ActiveLoc],
1299        &[],
1300        &[],
1301        &[],
1302        &[],
1303        &[],
1304        false,
1305    );
1306    add(
1307        "p_opnpc",
1308        &[PActivePlayer, ActiveNpc],
1309        &[],
1310        &[],
1311        &[],
1312        &[],
1313        &[],
1314        false,
1315    );
1316    add(
1317        "p_opnpct",
1318        &[PActivePlayer, ActiveNpc],
1319        &[],
1320        &[],
1321        &[],
1322        &[],
1323        &[],
1324        false,
1325    );
1326    add(
1327        "p_opobj",
1328        &[PActivePlayer, ActiveObj],
1329        &[],
1330        &[],
1331        &[],
1332        &[],
1333        &[],
1334        false,
1335    );
1336    add(
1337        "p_opplayer",
1338        &[PActivePlayer, ActivePlayer2],
1339        &[],
1340        &[],
1341        &[PActivePlayer2, ActivePlayer],
1342        &[],
1343        &[],
1344        false,
1345    );
1346    add(
1347        "p_opplayert",
1348        &[PActivePlayer, ActivePlayer2],
1349        &[],
1350        &[],
1351        &[PActivePlayer2, ActivePlayer],
1352        &[],
1353        &[],
1354        false,
1355    );
1356    {
1357        // p_pausebutton: sets last_com, corrupts everything except active + last_com
1358        let mut corrupt = delay_corrupt.clone();
1359        corrupt.retain(|p| *p != LastCom);
1360        add(
1361            "p_pausebutton",
1362            &[PActivePlayer],
1363            &[LastCom],
1364            &corrupt,
1365            &[PActivePlayer2],
1366            &[LastCom],
1367            &corrupt,
1368            false,
1369        );
1370    }
1371    add(
1372        "p_stopaction",
1373        &[PActivePlayer],
1374        &[],
1375        &[],
1376        &[PActivePlayer2],
1377        &[],
1378        &[],
1379        false,
1380    );
1381    add(
1382        "p_clearpendingaction",
1383        &[PActivePlayer],
1384        &[],
1385        &[],
1386        &[PActivePlayer2],
1387        &[],
1388        &[],
1389        false,
1390    );
1391    add(
1392        "p_telejump",
1393        &[PActivePlayer],
1394        &[],
1395        &[],
1396        &[PActivePlayer2],
1397        &[],
1398        &[],
1399        false,
1400    );
1401    add(
1402        "p_teleport",
1403        &[PActivePlayer],
1404        &[],
1405        &[],
1406        &[PActivePlayer2],
1407        &[],
1408        &[],
1409        false,
1410    );
1411    add(
1412        "p_walk",
1413        &[PActivePlayer],
1414        &[],
1415        &[],
1416        &[PActivePlayer2],
1417        &[],
1418        &[],
1419        false,
1420    );
1421    add(
1422        "projanim_pl",
1423        &[ActivePlayer],
1424        &[],
1425        &[],
1426        &[ActivePlayer2],
1427        &[],
1428        &[],
1429        false,
1430    );
1431    add(
1432        "queue",
1433        &[ActivePlayer],
1434        &[],
1435        &[],
1436        &[ActivePlayer2],
1437        &[],
1438        &[],
1439        false,
1440    );
1441    add(
1442        "queue*",
1443        &[ActivePlayer],
1444        &[],
1445        &[],
1446        &[ActivePlayer2],
1447        &[],
1448        &[],
1449        false,
1450    );
1451    add(
1452        "say",
1453        &[ActivePlayer],
1454        &[],
1455        &[],
1456        &[ActivePlayer2],
1457        &[],
1458        &[],
1459        false,
1460    );
1461    add("setidkit", &[PActivePlayer], &[], &[], &[], &[], &[], false);
1462    add(
1463        "walktrigger",
1464        &[ActivePlayer],
1465        &[],
1466        &[],
1467        &[ActivePlayer2],
1468        &[],
1469        &[],
1470        false,
1471    );
1472    add(
1473        "getwalktrigger",
1474        &[ActivePlayer],
1475        &[],
1476        &[],
1477        &[ActivePlayer2],
1478        &[],
1479        &[],
1480        false,
1481    );
1482    add(
1483        "settimer",
1484        &[ActivePlayer],
1485        &[],
1486        &[],
1487        &[ActivePlayer2],
1488        &[],
1489        &[],
1490        false,
1491    );
1492    add(
1493        "softtimer",
1494        &[ActivePlayer],
1495        &[],
1496        &[],
1497        &[ActivePlayer2],
1498        &[],
1499        &[],
1500        false,
1501    );
1502    add(
1503        "sound_synth",
1504        &[ActivePlayer],
1505        &[],
1506        &[],
1507        &[ActivePlayer2],
1508        &[],
1509        &[],
1510        false,
1511    );
1512    add(
1513        "spotanim_pl",
1514        &[ActivePlayer],
1515        &[],
1516        &[],
1517        &[ActivePlayer2],
1518        &[],
1519        &[],
1520        false,
1521    );
1522    add(
1523        "staffmodlevel",
1524        &[ActivePlayer],
1525        &[],
1526        &[],
1527        &[ActivePlayer2],
1528        &[],
1529        &[],
1530        false,
1531    );
1532    add(
1533        "stat",
1534        &[ActivePlayer],
1535        &[],
1536        &[],
1537        &[ActivePlayer2],
1538        &[],
1539        &[],
1540        false,
1541    );
1542    add(
1543        "stat_add",
1544        &[ActivePlayer],
1545        &[],
1546        &[],
1547        &[ActivePlayer2],
1548        &[],
1549        &[],
1550        false,
1551    );
1552    add(
1553        "stat_base",
1554        &[ActivePlayer],
1555        &[],
1556        &[],
1557        &[ActivePlayer2],
1558        &[],
1559        &[],
1560        false,
1561    );
1562    add(
1563        "stat_heal",
1564        &[ActivePlayer],
1565        &[],
1566        &[],
1567        &[ActivePlayer2],
1568        &[],
1569        &[],
1570        false,
1571    );
1572    add(
1573        "stat_sub",
1574        &[ActivePlayer],
1575        &[],
1576        &[],
1577        &[ActivePlayer2],
1578        &[],
1579        &[],
1580        false,
1581    );
1582    add(
1583        "stat_boost",
1584        &[ActivePlayer],
1585        &[],
1586        &[],
1587        &[ActivePlayer2],
1588        &[],
1589        &[],
1590        false,
1591    );
1592    add(
1593        "stat_drain",
1594        &[ActivePlayer],
1595        &[],
1596        &[],
1597        &[ActivePlayer2],
1598        &[],
1599        &[],
1600        false,
1601    );
1602    add(
1603        "stat_random",
1604        &[ActivePlayer],
1605        &[],
1606        &[],
1607        &[ActivePlayer2],
1608        &[],
1609        &[],
1610        false,
1611    );
1612    add(
1613        "uid",
1614        &[ActivePlayer],
1615        &[],
1616        &[],
1617        &[ActivePlayer2],
1618        &[],
1619        &[],
1620        false,
1621    );
1622    add(
1623        "weakqueue",
1624        &[ActivePlayer],
1625        &[],
1626        &[],
1627        &[ActivePlayer2],
1628        &[],
1629        &[],
1630        false,
1631    );
1632    add(
1633        "weakqueue*",
1634        &[ActivePlayer],
1635        &[],
1636        &[],
1637        &[ActivePlayer2],
1638        &[],
1639        &[],
1640        false,
1641    );
1642    add(
1643        "findhero",
1644        &[ActivePlayer],
1645        &[ActivePlayer2],
1646        &[],
1647        &[ActivePlayer2],
1648        &[ActivePlayer2],
1649        &[],
1650        true,
1651    );
1652    add(
1653        "both_heropoints",
1654        &[ActivePlayer, ActivePlayer2],
1655        &[],
1656        &[],
1657        &[ActivePlayer2, ActivePlayer],
1658        &[],
1659        &[],
1660        false,
1661    );
1662    add(
1663        "setgender",
1664        &[PActivePlayer],
1665        &[],
1666        &[],
1667        &[],
1668        &[],
1669        &[],
1670        false,
1671    );
1672    add(
1673        "setidkcolour",
1674        &[PActivePlayer],
1675        &[],
1676        &[],
1677        &[],
1678        &[],
1679        &[],
1680        false,
1681    );
1682    add(
1683        "p_animprotect",
1684        &[PActivePlayer],
1685        &[],
1686        &[],
1687        &[PActivePlayer2],
1688        &[],
1689        &[],
1690        false,
1691    );
1692    add(
1693        "runenergy",
1694        &[ActivePlayer],
1695        &[],
1696        &[],
1697        &[ActivePlayer2],
1698        &[],
1699        &[],
1700        false,
1701    );
1702    add(
1703        "weight",
1704        &[PActivePlayer],
1705        &[],
1706        &[],
1707        &[PActivePlayer2],
1708        &[],
1709        &[],
1710        false,
1711    );
1712    add(
1713        "p_run",
1714        &[PActivePlayer],
1715        &[],
1716        &[],
1717        &[PActivePlayer2],
1718        &[],
1719        &[],
1720        false,
1721    );
1722    add(
1723        "if_setscrollpos",
1724        &[ActivePlayer],
1725        &[],
1726        &[],
1727        &[],
1728        &[],
1729        &[],
1730        false,
1731    );
1732    add(
1733        "if_movesub",
1734        &[ActivePlayer],
1735        &[],
1736        &[],
1737        &[],
1738        &[],
1739        &[],
1740        false,
1741    );
1742    add(
1743        "set_player_op",
1744        &[ActivePlayer],
1745        &[],
1746        &[],
1747        &[],
1748        &[],
1749        &[],
1750        false,
1751    );
1752    add(
1753        "set_skill_level",
1754        &[ActivePlayer],
1755        &[],
1756        &[],
1757        &[ActivePlayer2],
1758        &[],
1759        &[],
1760        false,
1761    );
1762    add(
1763        "strongqueue",
1764        &[ActivePlayer],
1765        &[],
1766        &[],
1767        &[ActivePlayer2],
1768        &[],
1769        &[],
1770        false,
1771    );
1772    add(
1773        "strongqueue*",
1774        &[ActivePlayer],
1775        &[],
1776        &[],
1777        &[ActivePlayer2],
1778        &[],
1779        &[],
1780        false,
1781    );
1782
1783    for name in [
1784        "afk_event",
1785        "applydesign",
1786        "buffer_full",
1787        "getwindowmode",
1788        "hint_coord_slot",
1789        "hint_stop_slot",
1790        "if_closesub",
1791        "if_opensub",
1792        "if_opentop_mode",
1793        "if_setgraphic",
1794        "if_setrecol",
1795        "if_setresumebuttons",
1796        "loc_prefetch",
1797        "lowmemory",
1798        "music_playjingle",
1799        "music_playsong",
1800        "p_projanim_halfsq",
1801        "p_transmogrify",
1802        "playermember",
1803        "runclientscript",
1804        "runclientscriptvararg",
1805        "session_log",
1806        "setskincolour",
1807        "stat_total",
1808        "wealth_event",
1809    ] {
1810        add(name, &[ActivePlayer], &[], &[], &[], &[], &[], false);
1811    }
1812    // 647 compiles `queue*` and the other `*` queues as `queuevararg` and so on.
1813    for name in [
1814        "bas_readyanim",
1815        "bas_running",
1816        "bas_turnonspot",
1817        "bas_walk_b",
1818        "bas_walk_f",
1819        "bas_walk_l",
1820        "bas_walk_r",
1821        "if_setevents",
1822        "longqueuevararg",
1823        "queuevararg",
1824        "strongqueuevararg",
1825        "weakqueuevararg",
1826    ] {
1827        add(
1828            name,
1829            &[ActivePlayer],
1830            &[],
1831            &[],
1832            &[ActivePlayer2],
1833            &[],
1834            &[],
1835            false,
1836        );
1837    }
1838    add(
1839        "hint_player",
1840        &[ActivePlayer, ActivePlayer2],
1841        &[],
1842        &[],
1843        &[ActivePlayer2, ActivePlayer],
1844        &[],
1845        &[],
1846        false,
1847    );
1848    add(
1849        "last_targetcom",
1850        &[LastTargetslot],
1851        &[],
1852        &[],
1853        &[],
1854        &[],
1855        &[],
1856        false,
1857    );
1858    add(
1859        "player_findallzone",
1860        &[],
1861        &[FindPlayer],
1862        &[],
1863        &[],
1864        &[],
1865        &[],
1866        false,
1867    );
1868    add(
1869        "player_findnext",
1870        &[FindPlayer],
1871        &[ActivePlayer],
1872        &[],
1873        &[FindPlayer],
1874        &[ActivePlayer2],
1875        &[],
1876        true,
1877    );
1878
1879    // -----------------------------------------------------------------------
1880    // NPC ops
1881    // -----------------------------------------------------------------------
1882    add(
1883        "npc_add",
1884        &[],
1885        &[ActiveNpc],
1886        &[],
1887        &[],
1888        &[ActiveNpc2],
1889        &[],
1890        false,
1891    );
1892    add(
1893        "npc_anim",
1894        &[ActiveNpc],
1895        &[],
1896        &[],
1897        &[ActiveNpc2],
1898        &[],
1899        &[],
1900        false,
1901    );
1902    add(
1903        "npc_basestat",
1904        &[ActiveNpc],
1905        &[],
1906        &[],
1907        &[ActiveNpc2],
1908        &[],
1909        &[],
1910        false,
1911    );
1912    add(
1913        "npc_category",
1914        &[ActiveNpc],
1915        &[],
1916        &[],
1917        &[ActiveNpc2],
1918        &[],
1919        &[],
1920        false,
1921    );
1922    add(
1923        "npc_changetype",
1924        &[ActiveNpc],
1925        &[],
1926        &[],
1927        &[ActiveNpc2],
1928        &[],
1929        &[],
1930        false,
1931    );
1932    add(
1933        "npc_changetype_keepall",
1934        &[ActiveNpc],
1935        &[],
1936        &[],
1937        &[ActiveNpc2],
1938        &[],
1939        &[],
1940        false,
1941    );
1942    add(
1943        "npc_coord",
1944        &[ActiveNpc],
1945        &[],
1946        &[],
1947        &[ActiveNpc2],
1948        &[],
1949        &[],
1950        false,
1951    );
1952    add(
1953        "npc_damage",
1954        &[ActiveNpc],
1955        &[],
1956        &[],
1957        &[ActiveNpc2],
1958        &[],
1959        &[],
1960        false,
1961    );
1962    add(
1963        "npc_del",
1964        &[ActiveNpc],
1965        &[],
1966        &[],
1967        &[ActiveNpc2],
1968        &[],
1969        &[],
1970        false,
1971    );
1972    {
1973        // npc_delay: corrupts p_active_player, p_active_player2, find_*, last_*
1974        let mut corrupt: Vec<PointerType> = vec![PActivePlayer, PActivePlayer2];
1975        corrupt.extend_from_slice(find_group);
1976        corrupt.extend_from_slice(&[
1977            LastCom,
1978            LastInt,
1979            LastItem,
1980            LastSlot,
1981            LastTargetslot,
1982            LastUseitem,
1983            LastUseslot,
1984        ]);
1985        add(
1986            "npc_delay",
1987            &[ActiveNpc],
1988            &[],
1989            &corrupt,
1990            &[ActiveNpc2],
1991            &[],
1992            &[],
1993            false,
1994        );
1995    }
1996    add(
1997        "npc_facesquare",
1998        &[ActiveNpc],
1999        &[],
2000        &[],
2001        &[ActiveNpc2],
2002        &[],
2003        &[],
2004        false,
2005    );
2006    add(
2007        "npc_find",
2008        &[],
2009        &[ActiveNpc],
2010        &[],
2011        &[],
2012        &[ActiveNpc2],
2013        &[],
2014        true,
2015    );
2016    add(
2017        "npc_findcat",
2018        &[],
2019        &[ActiveNpc],
2020        &[],
2021        &[],
2022        &[ActiveNpc2],
2023        &[],
2024        true,
2025    );
2026    add(
2027        "npc_findallany",
2028        &[],
2029        &[FindNpc],
2030        &[],
2031        &[],
2032        &[FindNpc],
2033        &[],
2034        false,
2035    );
2036    add(
2037        "npc_findall",
2038        &[],
2039        &[FindNpc],
2040        &[],
2041        &[],
2042        &[FindNpc],
2043        &[],
2044        false,
2045    );
2046    add(
2047        "npc_findallzone",
2048        &[],
2049        &[FindNpc],
2050        &[],
2051        &[],
2052        &[],
2053        &[],
2054        false,
2055    );
2056    add(
2057        "npc_findnext",
2058        &[FindNpc],
2059        &[ActiveNpc],
2060        &[],
2061        &[FindNpc],
2062        &[ActiveNpc2],
2063        &[],
2064        true,
2065    );
2066    add(
2067        "npc_findexact",
2068        &[],
2069        &[ActiveNpc],
2070        &[],
2071        &[],
2072        &[ActiveNpc2],
2073        &[],
2074        true,
2075    );
2076    add(
2077        "npc_findhero",
2078        &[ActiveNpc],
2079        &[ActivePlayer],
2080        &[],
2081        &[ActiveNpc2],
2082        &[ActivePlayer2],
2083        &[],
2084        true,
2085    );
2086    add(
2087        "npc_finduid",
2088        &[],
2089        &[ActiveNpc],
2090        &[],
2091        &[],
2092        &[ActiveNpc2],
2093        &[],
2094        true,
2095    );
2096    add(
2097        "npc_getmode",
2098        &[ActiveNpc],
2099        &[],
2100        &[],
2101        &[ActiveNpc2],
2102        &[],
2103        &[],
2104        false,
2105    );
2106    add(
2107        "npc_heropoints",
2108        &[ActiveNpc, ActivePlayer],
2109        &[],
2110        &[],
2111        &[],
2112        &[],
2113        &[],
2114        false,
2115    );
2116    add(
2117        "npc_name",
2118        &[ActiveNpc],
2119        &[],
2120        &[],
2121        &[ActiveNpc2],
2122        &[],
2123        &[],
2124        false,
2125    );
2126    add(
2127        "npc_param",
2128        &[ActiveNpc],
2129        &[],
2130        &[],
2131        &[ActiveNpc2],
2132        &[],
2133        &[],
2134        false,
2135    );
2136    add(
2137        "npc_queue",
2138        &[ActiveNpc],
2139        &[],
2140        &[],
2141        &[ActiveNpc2],
2142        &[],
2143        &[],
2144        false,
2145    );
2146    add(
2147        "npc_queuevararg",
2148        &[ActiveNpc],
2149        &[],
2150        &[],
2151        &[ActiveNpc2],
2152        &[],
2153        &[],
2154        false,
2155    );
2156    add(
2157        "npc_range",
2158        &[ActiveNpc],
2159        &[],
2160        &[],
2161        &[ActiveNpc2],
2162        &[],
2163        &[],
2164        false,
2165    );
2166    add(
2167        "npc_say",
2168        &[ActiveNpc],
2169        &[],
2170        &[],
2171        &[ActiveNpc2],
2172        &[],
2173        &[],
2174        false,
2175    );
2176    add(
2177        "npc_sethunt",
2178        &[ActiveNpc],
2179        &[],
2180        &[],
2181        &[ActiveNpc2],
2182        &[],
2183        &[],
2184        false,
2185    );
2186    add(
2187        "npc_sethuntmode",
2188        &[ActiveNpc],
2189        &[],
2190        &[],
2191        &[ActiveNpc2],
2192        &[],
2193        &[],
2194        false,
2195    );
2196    add(
2197        "npc_setmode",
2198        &[ActiveNpc],
2199        &[],
2200        &[],
2201        &[ActiveNpc2],
2202        &[],
2203        &[],
2204        false,
2205    );
2206    add(
2207        "npc_walktrigger",
2208        &[ActiveNpc],
2209        &[],
2210        &[],
2211        &[ActiveNpc2],
2212        &[],
2213        &[],
2214        false,
2215    );
2216    add(
2217        "npc_settimer",
2218        &[ActiveNpc],
2219        &[],
2220        &[],
2221        &[ActiveNpc2],
2222        &[],
2223        &[],
2224        false,
2225    );
2226    add(
2227        "npc_stat",
2228        &[ActiveNpc],
2229        &[],
2230        &[],
2231        &[ActiveNpc2],
2232        &[],
2233        &[],
2234        false,
2235    );
2236    add(
2237        "npc_statadd",
2238        &[ActiveNpc],
2239        &[],
2240        &[],
2241        &[ActiveNpc2],
2242        &[],
2243        &[],
2244        false,
2245    );
2246    add(
2247        "npc_statheal",
2248        &[ActiveNpc],
2249        &[],
2250        &[],
2251        &[ActiveNpc2],
2252        &[],
2253        &[],
2254        false,
2255    );
2256    add(
2257        "npc_statsub",
2258        &[ActiveNpc],
2259        &[],
2260        &[],
2261        &[ActiveNpc2],
2262        &[],
2263        &[],
2264        false,
2265    );
2266    add(
2267        "npc_tele",
2268        &[ActiveNpc],
2269        &[],
2270        &[],
2271        &[ActiveNpc2],
2272        &[],
2273        &[],
2274        false,
2275    );
2276    add(
2277        "npc_type",
2278        &[ActiveNpc],
2279        &[],
2280        &[],
2281        &[ActiveNpc2],
2282        &[],
2283        &[],
2284        false,
2285    );
2286    add(
2287        "npc_uid",
2288        &[ActiveNpc],
2289        &[],
2290        &[],
2291        &[ActiveNpc2],
2292        &[],
2293        &[],
2294        false,
2295    );
2296    add(
2297        "projanim_npc",
2298        &[ActiveNpc],
2299        &[],
2300        &[],
2301        &[ActiveNpc2],
2302        &[],
2303        &[],
2304        false,
2305    );
2306    add(
2307        "spotanim_npc",
2308        &[ActiveNpc],
2309        &[],
2310        &[],
2311        &[ActiveNpc2],
2312        &[],
2313        &[],
2314        false,
2315    );
2316    add(
2317        "npc_walk",
2318        &[ActiveNpc],
2319        &[],
2320        &[],
2321        &[ActiveNpc2],
2322        &[],
2323        &[],
2324        false,
2325    );
2326    add(
2327        "npc_attackrange",
2328        &[ActiveNpc],
2329        &[],
2330        &[],
2331        &[ActiveNpc2],
2332        &[],
2333        &[],
2334        false,
2335    );
2336    {
2337        // npc_arrivedelay: same corruption set as npc_delay
2338        let mut corrupt: Vec<PointerType> = vec![PActivePlayer, PActivePlayer2];
2339        corrupt.extend_from_slice(find_group);
2340        corrupt.extend_from_slice(&[
2341            LastCom,
2342            LastInt,
2343            LastItem,
2344            LastSlot,
2345            LastTargetslot,
2346            LastUseitem,
2347            LastUseslot,
2348        ]);
2349        add(
2350            "npc_arrivedelay",
2351            &[ActiveNpc],
2352            &[],
2353            &corrupt,
2354            &[ActiveNpc2],
2355            &[],
2356            &[],
2357            false,
2358        );
2359    }
2360    add(
2361        "npc_inrange",
2362        &[ActiveNpc],
2363        &[],
2364        &[],
2365        &[ActiveNpc2],
2366        &[],
2367        &[],
2368        false,
2369    );
2370
2371    add(
2372        "npc_destination",
2373        &[ActiveNpc],
2374        &[],
2375        &[],
2376        &[ActiveNpc2],
2377        &[],
2378        &[],
2379        false,
2380    );
2381    add(
2382        "npc_huntnext",
2383        &[FindNpc],
2384        &[ActiveNpc],
2385        &[],
2386        &[FindNpc],
2387        &[ActiveNpc2],
2388        &[],
2389        true,
2390    );
2391    add(
2392        "npc_projanim_halfsq",
2393        &[ActiveNpc],
2394        &[],
2395        &[],
2396        &[],
2397        &[],
2398        &[],
2399        false,
2400    );
2401
2402    // -----------------------------------------------------------------------
2403    // Loc ops
2404    // -----------------------------------------------------------------------
2405    add(
2406        "loc_add",
2407        &[],
2408        &[ActiveLoc],
2409        &[],
2410        &[],
2411        &[ActiveLoc2],
2412        &[],
2413        false,
2414    );
2415    add(
2416        "loc_angle",
2417        &[ActiveLoc],
2418        &[],
2419        &[],
2420        &[ActiveLoc2],
2421        &[],
2422        &[],
2423        false,
2424    );
2425    add(
2426        "loc_anim",
2427        &[ActiveLoc],
2428        &[],
2429        &[],
2430        &[ActiveLoc2],
2431        &[],
2432        &[],
2433        false,
2434    );
2435    add(
2436        "loc_category",
2437        &[ActiveLoc],
2438        &[],
2439        &[],
2440        &[ActiveLoc2],
2441        &[],
2442        &[],
2443        false,
2444    );
2445    add(
2446        "loc_change",
2447        &[ActiveLoc],
2448        &[],
2449        &[],
2450        &[ActiveLoc2],
2451        &[],
2452        &[],
2453        false,
2454    );
2455    add(
2456        "loc_coord",
2457        &[ActiveLoc],
2458        &[],
2459        &[],
2460        &[ActiveLoc2],
2461        &[],
2462        &[],
2463        false,
2464    );
2465    add(
2466        "loc_del",
2467        &[ActiveLoc],
2468        &[],
2469        &[],
2470        &[ActiveLoc2],
2471        &[],
2472        &[],
2473        false,
2474    );
2475    add(
2476        "loc_find",
2477        &[],
2478        &[ActiveLoc],
2479        &[],
2480        &[],
2481        &[ActiveLoc2],
2482        &[],
2483        true,
2484    );
2485    add(
2486        "loc_findallzone",
2487        &[],
2488        &[FindLoc],
2489        &[],
2490        &[],
2491        &[FindLoc],
2492        &[],
2493        false,
2494    );
2495    add(
2496        "loc_findnext",
2497        &[FindLoc],
2498        &[ActiveLoc],
2499        &[],
2500        &[FindLoc],
2501        &[ActiveLoc2],
2502        &[],
2503        true,
2504    );
2505    add(
2506        "loc_name",
2507        &[ActiveLoc],
2508        &[],
2509        &[],
2510        &[ActiveLoc2],
2511        &[],
2512        &[],
2513        false,
2514    );
2515    add(
2516        "loc_param",
2517        &[ActiveLoc],
2518        &[],
2519        &[],
2520        &[ActiveLoc2],
2521        &[],
2522        &[],
2523        false,
2524    );
2525    add(
2526        "loc_shape",
2527        &[ActiveLoc],
2528        &[],
2529        &[],
2530        &[ActiveLoc2],
2531        &[],
2532        &[],
2533        false,
2534    );
2535    add(
2536        "loc_type",
2537        &[ActiveLoc],
2538        &[],
2539        &[],
2540        &[ActiveLoc2],
2541        &[],
2542        &[],
2543        false,
2544    );
2545
2546    add("loc_merge", &[ActiveLoc], &[], &[], &[], &[], &[], false);
2547
2548    // -----------------------------------------------------------------------
2549    // Obj ops
2550    // -----------------------------------------------------------------------
2551    add(
2552        "obj_add",
2553        &[ActivePlayer],
2554        &[ActiveObj],
2555        &[],
2556        &[ActivePlayer2],
2557        &[ActiveObj2],
2558        &[],
2559        false,
2560    );
2561    add(
2562        "obj_addall",
2563        &[],
2564        &[ActiveObj],
2565        &[],
2566        &[],
2567        &[ActiveObj2],
2568        &[],
2569        false,
2570    );
2571    add(
2572        "obj_coord",
2573        &[ActiveObj],
2574        &[],
2575        &[],
2576        &[ActiveObj2],
2577        &[],
2578        &[],
2579        false,
2580    );
2581    add(
2582        "obj_count",
2583        &[ActiveObj],
2584        &[],
2585        &[],
2586        &[ActiveObj2],
2587        &[],
2588        &[],
2589        false,
2590    );
2591    add(
2592        "obj_del",
2593        &[ActiveObj],
2594        &[],
2595        &[],
2596        &[ActiveObj2],
2597        &[],
2598        &[],
2599        false,
2600    );
2601    add(
2602        "obj_name",
2603        &[ActiveObj],
2604        &[],
2605        &[],
2606        &[ActiveObj2],
2607        &[],
2608        &[],
2609        false,
2610    );
2611    add(
2612        "obj_param",
2613        &[ActiveObj],
2614        &[],
2615        &[],
2616        &[ActiveObj2],
2617        &[],
2618        &[],
2619        false,
2620    );
2621    add(
2622        "obj_getvar",
2623        &[ActiveObj],
2624        &[],
2625        &[],
2626        &[ActiveObj2],
2627        &[],
2628        &[],
2629        false,
2630    );
2631    add(
2632        "obj_setvar",
2633        &[ActiveObj],
2634        &[],
2635        &[],
2636        &[ActiveObj2],
2637        &[],
2638        &[],
2639        false,
2640    );
2641    add(
2642        "obj_takeitem",
2643        &[ActiveObj, ActivePlayer],
2644        &[],
2645        &[],
2646        &[ActiveObj2, ActivePlayer2],
2647        &[],
2648        &[],
2649        false,
2650    );
2651    add(
2652        "obj_type",
2653        &[ActiveObj],
2654        &[],
2655        &[],
2656        &[ActiveObj2],
2657        &[],
2658        &[],
2659        false,
2660    );
2661    add(
2662        "obj_find",
2663        &[],
2664        &[ActiveObj],
2665        &[],
2666        &[],
2667        &[ActiveObj2],
2668        &[],
2669        false,
2670    );
2671    add(
2672        "obj_findallzone",
2673        &[],
2674        &[FindObj],
2675        &[],
2676        &[],
2677        &[FindObj],
2678        &[],
2679        false,
2680    );
2681    add(
2682        "obj_findnext",
2683        &[FindObj],
2684        &[ActiveObj],
2685        &[],
2686        &[FindObj],
2687        &[ActiveObj2],
2688        &[],
2689        true,
2690    );
2691
2692    // -----------------------------------------------------------------------
2693    // Inventory ops
2694    // -----------------------------------------------------------------------
2695    add(
2696        "inv_add",
2697        &[ActivePlayer],
2698        &[],
2699        &[],
2700        &[ActivePlayer2],
2701        &[],
2702        &[],
2703        false,
2704    );
2705    add(
2706        "inv_changeslot",
2707        &[ActivePlayer],
2708        &[],
2709        &[],
2710        &[ActivePlayer2],
2711        &[],
2712        &[],
2713        false,
2714    );
2715    add(
2716        "inv_clear",
2717        &[ActivePlayer],
2718        &[],
2719        &[],
2720        &[ActivePlayer2],
2721        &[],
2722        &[],
2723        false,
2724    );
2725    add(
2726        "inv_del",
2727        &[ActivePlayer],
2728        &[],
2729        &[],
2730        &[ActivePlayer2],
2731        &[],
2732        &[],
2733        false,
2734    );
2735    add(
2736        "inv_delslot",
2737        &[ActivePlayer],
2738        &[],
2739        &[],
2740        &[ActivePlayer2],
2741        &[],
2742        &[],
2743        false,
2744    );
2745    add(
2746        "inv_dropitem",
2747        &[ActivePlayer],
2748        &[ActiveObj],
2749        &[],
2750        &[ActivePlayer2],
2751        &[ActiveObj2],
2752        &[],
2753        false,
2754    );
2755    add(
2756        "inv_dropitem_delayed",
2757        &[ActivePlayer],
2758        &[ActiveObj],
2759        &[],
2760        &[ActivePlayer2],
2761        &[ActiveObj2],
2762        &[],
2763        false,
2764    );
2765    add(
2766        "inv_dropslot",
2767        &[ActivePlayer],
2768        &[ActiveObj],
2769        &[],
2770        &[ActivePlayer2],
2771        &[ActiveObj2],
2772        &[],
2773        false,
2774    );
2775    add(
2776        "inv_freespace",
2777        &[ActivePlayer],
2778        &[],
2779        &[],
2780        &[ActivePlayer2],
2781        &[],
2782        &[],
2783        false,
2784    );
2785    add(
2786        "inv_getnum",
2787        &[ActivePlayer],
2788        &[],
2789        &[],
2790        &[ActivePlayer2],
2791        &[],
2792        &[],
2793        false,
2794    );
2795    add(
2796        "inv_getobj",
2797        &[ActivePlayer],
2798        &[],
2799        &[],
2800        &[ActivePlayer2],
2801        &[],
2802        &[],
2803        false,
2804    );
2805    add(
2806        "inv_getvar",
2807        &[ActivePlayer],
2808        &[],
2809        &[],
2810        &[ActivePlayer2],
2811        &[],
2812        &[],
2813        false,
2814    );
2815    add(
2816        "inv_itemspace",
2817        &[ActivePlayer],
2818        &[],
2819        &[],
2820        &[ActivePlayer2],
2821        &[],
2822        &[],
2823        false,
2824    );
2825    add(
2826        "inv_itemspace2",
2827        &[ActivePlayer],
2828        &[],
2829        &[],
2830        &[ActivePlayer2],
2831        &[],
2832        &[],
2833        false,
2834    );
2835    add(
2836        "inv_movefromslot",
2837        &[ActivePlayer],
2838        &[],
2839        &[],
2840        &[ActivePlayer2],
2841        &[],
2842        &[],
2843        false,
2844    );
2845    add(
2846        "inv_movetoslot",
2847        &[ActivePlayer],
2848        &[],
2849        &[],
2850        &[ActivePlayer2],
2851        &[],
2852        &[],
2853        false,
2854    );
2855    add(
2856        "both_moveinv",
2857        &[ActivePlayer, ActivePlayer2],
2858        &[],
2859        &[],
2860        &[ActivePlayer2, ActivePlayer],
2861        &[],
2862        &[],
2863        false,
2864    );
2865    add(
2866        "inv_moveitem",
2867        &[ActivePlayer],
2868        &[],
2869        &[],
2870        &[ActivePlayer2],
2871        &[],
2872        &[],
2873        false,
2874    );
2875    add(
2876        "inv_moveitem_cert",
2877        &[ActivePlayer],
2878        &[],
2879        &[],
2880        &[ActivePlayer2],
2881        &[],
2882        &[],
2883        false,
2884    );
2885    add(
2886        "inv_moveitem_uncert",
2887        &[ActivePlayer],
2888        &[],
2889        &[],
2890        &[ActivePlayer2],
2891        &[],
2892        &[],
2893        false,
2894    );
2895    add(
2896        "inv_setslot",
2897        &[ActivePlayer],
2898        &[],
2899        &[],
2900        &[ActivePlayer2],
2901        &[],
2902        &[],
2903        false,
2904    );
2905    add(
2906        "inv_setvar",
2907        &[ActivePlayer],
2908        &[],
2909        &[],
2910        &[ActivePlayer2],
2911        &[],
2912        &[],
2913        false,
2914    );
2915    add(
2916        "inv_total",
2917        &[ActivePlayer],
2918        &[],
2919        &[],
2920        &[ActivePlayer2],
2921        &[],
2922        &[],
2923        false,
2924    );
2925    add(
2926        "inv_totalcat",
2927        &[ActivePlayer],
2928        &[],
2929        &[],
2930        &[ActivePlayer2],
2931        &[],
2932        &[],
2933        false,
2934    );
2935    add(
2936        "inv_transmit",
2937        &[ActivePlayer],
2938        &[],
2939        &[],
2940        &[ActivePlayer2],
2941        &[],
2942        &[],
2943        false,
2944    );
2945    add(
2946        "invother_transmit",
2947        &[ActivePlayer, ActivePlayer2],
2948        &[],
2949        &[],
2950        &[ActivePlayer2, ActivePlayer],
2951        &[],
2952        &[],
2953        false,
2954    );
2955    add(
2956        "inv_stoptransmit",
2957        &[ActivePlayer],
2958        &[],
2959        &[],
2960        &[ActivePlayer2],
2961        &[],
2962        &[],
2963        false,
2964    );
2965    add(
2966        "both_dropslot",
2967        &[ActivePlayer, ActivePlayer2],
2968        &[],
2969        &[],
2970        &[ActivePlayer2, ActivePlayer],
2971        &[],
2972        &[],
2973        false,
2974    );
2975    add(
2976        "inv_dropall",
2977        &[ActivePlayer],
2978        &[],
2979        &[],
2980        &[ActivePlayer2],
2981        &[],
2982        &[],
2983        false,
2984    );
2985    add(
2986        "inv_totalparam",
2987        &[ActivePlayer],
2988        &[],
2989        &[],
2990        &[ActivePlayer2],
2991        &[],
2992        &[],
2993        false,
2994    );
2995    add(
2996        "inv_totalparam_stack",
2997        &[ActivePlayer],
2998        &[],
2999        &[],
3000        &[ActivePlayer2],
3001        &[],
3002        &[],
3003        false,
3004    );
3005
3006    // -----------------------------------------------------------------------
3007    // String ops
3008    // -----------------------------------------------------------------------
3009    add(
3010        "text_gender",
3011        &[ActivePlayer],
3012        &[],
3013        &[],
3014        &[ActivePlayer2],
3015        &[],
3016        &[],
3017        false,
3018    );
3019
3020    // -----------------------------------------------------------------------
3021    // Controller ops
3022    // -----------------------------------------------------------------------
3023    for name in [
3024        "controller_coord",
3025        "controller_queue",
3026        "controller_queuevararg",
3027        "controller_settimer",
3028    ] {
3029        add(
3030            name,
3031            &[ActiveController],
3032            &[],
3033            &[],
3034            &[ActiveController2],
3035            &[],
3036            &[],
3037            false,
3038        );
3039    }
3040    add(
3041        "controller_del",
3042        &[ActiveController],
3043        &[],
3044        &[ActiveController],
3045        &[ActiveController2],
3046        &[],
3047        &[ActiveController2],
3048        false,
3049    );
3050    add(
3051        "controller_add",
3052        &[],
3053        &[ActiveController],
3054        &[],
3055        &[],
3056        &[ActiveController2],
3057        &[],
3058        false,
3059    );
3060    add(
3061        "controller_findexact",
3062        &[],
3063        &[ActiveController],
3064        &[],
3065        &[],
3066        &[ActiveController2],
3067        &[],
3068        true,
3069    );
3070
3071    // -----------------------------------------------------------------------
3072    // Region ops: a region (instance) the script created or found
3073    // -----------------------------------------------------------------------
3074    for name in [
3075        "region_getcoord",
3076        "region_set",
3077        "region_uid",
3078        "region_setexitcoord",
3079    ] {
3080        add(
3081            name,
3082            &[ActiveRegion],
3083            &[],
3084            &[],
3085            &[ActiveRegion2],
3086            &[],
3087            &[],
3088            false,
3089        );
3090    }
3091    add(
3092        "region_create",
3093        &[],
3094        &[ActiveRegion],
3095        &[],
3096        &[],
3097        &[ActiveRegion2],
3098        &[],
3099        false,
3100    );
3101    for name in ["region_findbycoord", "region_findbyuid"] {
3102        add(
3103            name,
3104            &[],
3105            &[ActiveRegion],
3106            &[],
3107            &[],
3108            &[ActiveRegion2],
3109            &[],
3110            true,
3111        );
3112    }
3113
3114    // -----------------------------------------------------------------------
3115    // DB ops
3116    // -----------------------------------------------------------------------
3117    add("db_findnext", &[FindDb], &[], &[], &[], &[], &[], false);
3118    add("db_find", &[], &[FindDb], &[], &[], &[], &[], false);
3119    add("db_find_refine", &[FindDb], &[], &[], &[], &[], &[], false);
3120    add("db_listall", &[], &[FindDb], &[], &[], &[], &[], false);
3121    add(
3122        "db_listall_with_count",
3123        &[],
3124        &[FindDb],
3125        &[],
3126        &[],
3127        &[],
3128        &[],
3129        false,
3130    );
3131
3132    map
3133}