View/Edit #12:_move_obj _move!_obj

Switch to edit mode.

Name(s): _move_obj _move!_obj
1:  "Move an object.  Called by @move & @join."
2:  if (caller != this)
3:    raise(E_PERM)
4:  endif
5:  set_task_perms(this)
6:  {dobj, moveto} = args
7:  nice = !index(verb, "!")
8:  if (typeof(moveto) == $OBJ)
9:    iobjstr = tostr(iobj = moveto)
10: else
11:   iobj = this:my_match_object(iobjstr = moveto)
12: endif
13: if (iobj != $nothing && $command_utils:object_match_failed(iobj, iobjstr))
14:   return
15: endif
16: old_loc = dobj.location
17: if (old_loc == iobj)
18:   $msg:mtell("already_there", dobj, iobj)
19:   return
20: endif
21: try
22:   r = this:_move(dobj, iobj, !nice)
23:   if (dobj.location != old_loc)
24:     "Note that the move is now done *before* notifiers are printed."
25:     "This avoids 'traps' when someone accidentally (deliberately?) breaks a notify verb or whatnot."
26:     "Write all the funky notifiers."
27:     valid(old_loc) && $msg:lmtell({dobj}, {dobj.location}, {old_loc, ""}, "msg_odepart")
28:     if (dobj.location == iobj)
29:       valid(dobj.location) && $msg:lmtell({dobj}, {old_loc}, {dobj, "msg_arrive"}, "msg_oarrive")
30:       $msg:mtell("moved", old_loc)
31:     else
32:       "Quack?"
33:       valid(dobj.location) && $msg:lmtell({dobj}, {old_loc}, {dobj, "msg_arrive_quack"}, "msg_oarrive_quack")
34:       $msg:mtell("deflected", old_loc)
35:     endif
36:   endif
37:   "Move failed; try tells us the explanation."
38: except (E_NACC)
39:   $msg:mtell("bounced", old_loc)
40: except (E_RANGE)
41:   $msg:mtell("move2far", old_loc)
42: except (E_RECMOVE)
43:   $msg:mtell("topology", dobj, iobj)
44: except error (ANY)
45:   $msg:mtell("stubborn", old_loc, error[2])
46: endtry
47: "Last modified by Dax (#789) on Tue May  3 13:47:06 2005 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Slacker (#55)

You are not logged in.

[home | help | who | search | setup | code]