Abrir Portas

Descrição

Abra a porta ao tentar passar por ela ao caminhar no WASD.

Autor:

                
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
local wsadWalking = modules.game_walking.wsadWalking local doorsIds = { 1631, 1629, 1632, 5129 } function checkForDoors(pos) local tile = g_map.getTile(pos) if tile then local useThing = tile:getTopUseThing() if useThing and table.find(doorsIds, useThing:getId()) then g_game.use(useThing) end end end onKeyPress(function(keys) local pos = player:getPosition() if keys == 'Up' or (wsadWalking and keys == 'W') then pos.y = pos.y - 1 elseif keys == 'Down' or (wsadWalking and keys == 'S') then pos.y = pos.y + 1 elseif keys == 'Left' or (wsadWalking and keys == 'A') then pos.x = pos.x - 1 elseif keys == 'Right' or (wsadWalking and keys == 'D') then pos.x = pos.x + 1 end checkForDoors(pos) end)