onLookInput intercepts look commands directed at gambling fixtures before the engine's look handler runs. If the target matches a fixture present in the room, it sends the description directly and cancels the event so the engine does not process it further.
(e events.Event)
| 95 | // room, it sends the description directly and cancels the event so the engine |
| 96 | // does not process it further. |
| 97 | func (g *GamblingModule) onLookInput(e events.Event) events.ListenerReturn { |
| 98 | evt, ok := e.(events.Input) |
| 99 | if !ok || evt.UserId == 0 { |
| 100 | return events.Continue |
| 101 | } |
| 102 | |
| 103 | target := parseLookTarget(evt.InputText) |
| 104 | if target == "" { |
| 105 | return events.Continue |
| 106 | } |
| 107 | |
| 108 | user := users.GetByUserId(evt.UserId) |
| 109 | if user == nil { |
| 110 | return events.Continue |
| 111 | } |
| 112 | |
| 113 | room := rooms.LoadRoom(user.Character.RoomId) |
| 114 | if room == nil { |
| 115 | return events.Continue |
| 116 | } |
| 117 | |
| 118 | if _, c := util.FindMatchIn(target, `slot machine`, `slots`, `slot`); c != `` && roomHasSlots(room) { |
| 119 | g.sendLookDescription(user, room, `slot machine`, g.slotMachineNounDesc(room.RoomId)) |
| 120 | return events.Cancel |
| 121 | } |
| 122 | |
| 123 | if _, c := util.FindMatchIn(target, `claw machine`, `claw`); c != `` && roomHasClaw(room) { |
| 124 | g.sendLookDescription(user, room, `claw machine`, g.clawMachineNounDesc()) |
| 125 | return events.Cancel |
| 126 | } |
| 127 | |
| 128 | return events.Continue |
| 129 | } |
| 130 | |
| 131 | // sendLookDescription sends a noun look response matching the framing used by |
| 132 | // the core look command: blank line, "You look at the <noun>:", blank line, |
nothing calls this directly
no test coverage detected