Skip to content

Commit ae20e28

Browse files
committed
fix broken key repeats after going into a separate interface
1 parent 7833db4 commit ae20e28

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

src/multiplayer/multiplayer.lua

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ local function connectToMniip(ip,port,nick)
102102
end
103103
if err=="This nick is already on the server" then
104104
nick = nick:gsub("(.)$",function(s) local n=tonumber(s) if n and n+1 <= 9 then return n+1 else return n..'0' end end)
105-
username = nick
106105
return connectToMniip(ip,port,nick)
107106
end
108107
return false,err
@@ -112,6 +111,7 @@ local function connectToMniip(ip,port,nick)
112111

113112
con.socket = sock
114113
con.connected = true
114+
username = nick
115115
return true
116116
end
117117
--get up to a null (\0)
@@ -584,17 +584,15 @@ new=function(x,y,w,h)
584584
if chatcommands[cmd] then
585585
chatcommands[cmd](self,msg,args)
586586
--self:addline("Executed "..cmd.." "..rest)
587-
else
588-
self:addline("No such command: "..cmd.." "..rest,255,50,50)
587+
return
589588
end
589+
end
590+
--normal chat
591+
if con.connected then
592+
conSend(19,text,true)
593+
self:addline(username .. ": ".. text,200,200,200)
590594
else
591-
--normal chat
592-
if con.connected then
593-
conSend(19,text,true)
594-
self:addline(username .. ": ".. text,200,200,200)
595-
else
596-
self:addline("Not connected to server!",255,50,50)
597-
end
595+
self:addline("Not connected to server!",255,50,50)
598596
end
599597
end
600598
end
@@ -1338,8 +1336,12 @@ local function step()
13381336
if not L.chatHidden then chatwindow:draw() else showbutton:draw() end
13391337
if hooks_enabled then
13401338
if pressedKeys and pressedKeys["repeat"] < socket.gettime() then
1341-
chatwindow:textprocess(pressedKeys["key"],pressedKeys["nkey"],pressedKeys["modifier"],pressedKeys["event"])
1342-
pressedKeys["repeat"] = socket.gettime()+.075
1339+
if pressedKeys["repeat"] < socket.gettime()-.05 then
1340+
pressedKeys = nil
1341+
else
1342+
chatwindow:textprocess(pressedKeys["key"],pressedKeys["nkey"],pressedKeys["modifier"],pressedKeys["event"])
1343+
pressedKeys["repeat"] = socket.gettime()+.065
1344+
end
13431345
end
13441346
drawStuff()
13451347
sendStuff()

src/multiplayer/multiplayer.lua.cpp

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

src/simulation/elements/INST.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void INST_init_element(ELEMENT_INIT_FUNC_ARGS)
150150

151151
elem->Flammable = 0;
152152
elem->Explosive = 0;
153-
elem->Meltable = 1;
153+
elem->Meltable = 0;
154154
elem->Hardness = 1;
155155

156156
elem->Weight = 100;

0 commit comments

Comments
 (0)