-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCORE 11 - Interactivity Overrides.txt
55 lines (35 loc) · 4.04 KB
/
CORE 11 - Interactivity Overrides.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
&P_GOTO #hobj=[if(setr(!,gm_can_move(%#),res),1,0[set(%!,%q<res>)])]
&AF_GOTO #hobj=u(SHOW_ERROR)
&P_INVENTORY #hobj=[if(setr(!,gm_can_see(%#),res),1,0[set(%!,%q<res>)])]
&AF_INVENTORY #hobj=u(SHOW_ERROR)
&P_LOOK #hobj=[if(setr(!,gm_can_see(%#),res),1,0[set(%!,%q<res>)])]
&AF_LOOK #hobj=u(SHOW_ERROR)
&HOOK.MUD #hobj=@dolist/inline score kill slay +players use={@hook/ignore %d0};@dolist/inline goto inventory look={@hook/permit %d0;@hook/fail %d0};@dolist/inline look give get drop={@hook/ignore %d0}
@skip isdbref(tag(setr(1,interact)))={@assert/inline isdbref(globalroom())=@pemit %#=ERROR: No master room set!;@assert/inline isdbref(setr(0,create(Interaction System,,t)))=@pemit %#=ERROR: Could not create code object %q1: %q0;@set %q0=INDESTRUCTIBLE !NO_COMMAND;@tag/add %q1=%q0;@tel %q0=globalroom()}
@@ Commands and stuff.
&TARGET #hobj=cor(default(%!/I_%0.BYPASS,0),not(strlen(%1)),isobjid(%1),isdbref(%1),istag(%1),match(%1,me here))
&I_LOOK #hobj=[u(TARGET,LOOK,rest(%-m))]
&I_GIVE #hobj=
&I_GET #hobj=[u(TARGET,GET,rest(%-m))]
&I_DROP #hobj=[u(TARGET,DROP,rest(%-m))]
&CMD.INTERACT #interact=$^(?s)(?\:@|\+)?(l|lo|loo|look|gi|giv|give|ge|get|dr|dro|drop)(?\:/(\\S+)?)?(?\: +(.+?))?$:th setq(!,switch(%1,l*,look,gi*,give,ge*,get,d*,drop),cmd);@set #hobj=I_%q<cmd>.BYPASS:1;@attach #inc/GET_SWITCH=%2,%q<cmd>;@attach/nobreak %!/SW.%q<cmd>.[strfirstof(%q<switch>,MAIN)]=%3;@set #hobj=I_%q<cmd>.BYPASS:0
@set #interact/CMD.INTERACT=regexp
&FIL.EQUIPPED #interact=cor(hastoggle(%0,WIELDED),hastoggle(%0,WORN))
&FIL.NOTEQUIPPED #interact=!u(FIL.EQUIPPED,%0)
&FIL.NOTDARK #interact=!hasflag(%0,DARK)
&FN.CHECK.EQUIPPED #interact=filter(FIL.EQUIPPED,objeval(%0,lcon(%#,VISIBLE,,,1),3))
&FN.CHECK.CARRIED #interact=filter(FIL.NOTEQUIPPED,objeval(%0,lcon(%#,VISIBLE,,,1),3))
&FN.CHECK.LOCATION #interact=listdiff(objeval(%0,lcon(%l,VISIBLE,,,1),3),objid(%0))
&FN.CHECK.EXITS #interact=objeval(%0,lexits(%l,,,,1),3)
&FN.MATCH #interact=t(strlen(grab(gm_keywords_for(%1,%0),%2*,|)))
&FN.CHECK #interact=trim(switch(%1,me,%0,here,objid(loc(%0)),iter(strfirstof(%2,LOCATION EXITS CARRIED EQUIPPED),squish(iter(u(FN.CHECK.%i0,%0),if(u(FN.MATCH,%0,%i0,%1),objid(%i0)[ibreak(0)][ibreak(1)]))))))
@@ %0 - target, %1 - input text, %2 - types
&SW.LOOK.MAIN #interact=@assert/inline isobjid(setr(!,u(FN.CHECK,%:,%0),res))=@pemit %#=I don't see that here.;@sudo %#={look %q<res>}
&SW.GET.MAIN #interact=@assert/inline isobjid(setr(!,u(FN.CHECK,%:,%0,LOCATION),res))=@pemit %#=I don't see that here.;@sudo %#={get %q<res>}
&SW.DROP.MAIN #interact=@assert/inline isobjid(setr(!,u(FN.CHECK,%:,%0,CARRIED),res))=@pemit %#=I don't see that here.;@sudo %#={drop %q<res>}
@@ This command is idempotent and not meant to be called normally.
&CMD.HANDLE_RELOCATE #interact=$handle_relocate:th setq(!,default(%#/GAME.LASTLOC,#-1),lastloc);@skip strmatch(%q<lastloc>,objid(%l))={@set %#=GAME.LASTLOC:[objid(%l)];@attach %!/HANDLE.RELOCATE=%:,%q<lastloc>,objid(%l),msecs()}
&HANDLE.RELOCATE #interact=@dolist/inline sort(lattr(%!/HANDLE.RELOCATE.*))={@attach/nobreak %!/%d0}
&HANDLE.RELOCATE.000_ZONECHANGE #interact=th setq(!,upzones(%1),oldupzones);th setq(!,upzones(%0),newupzones);@skip strmatch(%q<oldupzones>,%q<newupzones>)={@attach %!/HANDLE.ZONECHANGE=%0,%q<newupzones>,revwords(listdiff(%q<oldupzones>,%q<newupzones>)),revwords(listdiff(%q<newupzones>,%q<oldupzones>)),msecs(),crc32(%0,objid(%!),%q<oldupzones>,%q<newupzones>)}
&FN.HASHRETAIN #gfun=lte(sub(%1,after(%0,~)),10)
&HANDLE.ZONECHANGE #interact=@set %0=GAME.UPZONES:%1;@set %0=GAME.UPZONES.HASH:[setunion(filter(FN.HASHRETAIN,get(%0/GAME.UPZONES.HASH),|,|,%4),%5~%4)];th setq(!,filter(#lambda/[lit(hastotem(%2,%0))],CHARACTER ITEM STRUCTURE REGION,%b,%b,%#),totems);@if words(%2)={@dolist/inline/nobreak %2={@trigger/inline %d0/ZONE.LEAVE=%0,%q<totems>}};@if words(%3)={@dolist/inline/nobreak %3={@trigger/inline %d0/ZONE.ENTER=%0,%q<totems>}};th setq(!,setunion(lcon(%0),if(hasflag(%0,ZONEMASTER),zlcon(%0))),contents);@if words(%q<contents>)={@dolist %q<contents>={@skip strlen(grab(get(##/GAME.UPZONES.HASH),%5~*))=@attach %!/HANDLE.ZONECHANGE=##,%2,%3,%4,%5}}