revisit exit thoughts after break
parent
31af07f7e7
commit
dd5c377144
|
@ -41,6 +41,12 @@ It's tempting to have the `exits` map because of its simplicity, but it actually
|
|||
|
||||
TODO draft something new
|
||||
|
||||
Coming back to this after a long break, this new scheme with the exits table seems strictly worse than the tildemush approach. i don't like the amount of book keeping in the new approach--that's complexity that can lead to bugs. i think it's ultimately most elegant to just...let the exit exist in two rooms.
|
||||
|
||||
aside: i want to think through why exits shouldn't be on a room but it's a pretty quick answer. i don't want rooms that aren't world editable to be un-connectable to other things. if someone comes along and makes room A and then never comes back, it should be tunnel-able to from other rooms. i like the idea of people finding some cobwebbed room and then building a ladder up to it from somewhere.
|
||||
|
||||
so i'm going back to the tildemush approach. the next question is; is the exit maps a useful thing? couldn't the go handler just add a second, mirrored go handler? a handler that checks room directionality?
|
||||
|
||||
## server beta
|
||||
|
||||
- [x] grpc server
|
||||
|
|
|
@ -19,11 +19,13 @@ func witchSees(l *lua.LState) int {
|
|||
return addPatternHandler(l, "emote")
|
||||
}
|
||||
|
||||
func witchGo(l *lua.LState) int {
|
||||
// TODO get the handler map
|
||||
// - check if handler map has a Go handler already, exit early if so
|
||||
// TODO register this object as an exit in DB
|
||||
return addPatternHandler(l, "go")
|
||||
func witchGoes(l *lua.LState) int {
|
||||
// arg 0: direction
|
||||
// arg 1: from room
|
||||
// arg 2: to room
|
||||
// TODO call addPatternHandler with "go" verb and direction pattern; figure out how to call moveSender etc
|
||||
// TODO call addPatternHandler again for the reverse direction
|
||||
return -1
|
||||
}
|
||||
|
||||
func witchSeen(l *lua.LState) int {
|
||||
|
|
|
@ -130,7 +130,7 @@ func NewScriptContext(db db.DB, getSend func(string) func(*proto.ClientMessage)
|
|||
l.SetGlobal("has", l.NewFunction(witchHas))
|
||||
l.SetGlobal("hears", l.NewFunction(witchHears))
|
||||
l.SetGlobal("sees", l.NewFunction(witchSees))
|
||||
l.SetGlobal("go", l.NewFunction(witchGo))
|
||||
l.SetGlobal("goes", l.NewFunction(witchGoes))
|
||||
l.SetGlobal("seen", l.NewFunction(witchSeen))
|
||||
l.SetGlobal("my", l.NewFunction(witchMy))
|
||||
l.SetGlobal("_handlers", l.NewTable())
|
||||
|
|
|
@ -159,3 +159,35 @@ provides("give $this $money $unit", function(args)
|
|||
say("i need more money")
|
||||
end
|
||||
end)
|
||||
|
||||
-- Example 3: a rusty door
|
||||
has({
|
||||
name = "rusty metal door"
|
||||
description = "it's almost fully consumed by rust but still heavy and solid feeling"
|
||||
})
|
||||
|
||||
allows({
|
||||
read = "world",
|
||||
write = "owner"
|
||||
carry = "owner",
|
||||
execute = "world",
|
||||
})
|
||||
|
||||
-- option 1: fully manual
|
||||
|
||||
provides("go east", function(args)
|
||||
if sender.where = "gallery" then
|
||||
move_sender("ossuary")
|
||||
end
|
||||
end)
|
||||
|
||||
provides("go west", function(args)
|
||||
if sender.where = "ossuary" then
|
||||
move_sender("gallery")
|
||||
end
|
||||
end)
|
||||
|
||||
-- option 2: magical helper
|
||||
|
||||
-- automatically creates the two `go` handlers above
|
||||
goes("east", "gallery", "ossuary")
|
||||
|
|
Loading…
Reference in New Issue