Skip to content
Permalink
Browse files

Merge branch 'improve-luacontroller'

However, without the print_count limiting functionality

Conflicts:
	mesecons_luacontroller/init.lua
  • Loading branch information
Jeija
Jeija committed Nov 25, 2014
2 parents f69caba + 085b4d8 commit 4bd9d2a9ec84347e7c7ee488664120e39643a013
Showing with 425 additions and 371 deletions.
  1. +30 −29 mesecons/legacy.lua
  2. +395 −342 mesecons_luacontroller/init.lua
@@ -1,29 +1,30 @@
-- Ugly hack to prevent breaking compatibility with other mods
-- Just remove the following two functions to delete the hack, to be done when other mods have updated
function mesecon.receptor_on(self, pos, rules)
if (self.receptor_on) then
print("[Mesecons] Warning: A mod with mesecon support called mesecon:receptor_on.")
print("[Mesecons] If you are the programmer of this mod, please update it ")
print("[Mesecons] to use mesecon.receptor_on instead. mesecon:* is deprecated")
print("[Mesecons] Otherwise, please make sure you're running the latest version")
print("[Mesecons] of that mod and inform the mod creator.")
else
rules = pos
pos = self
end
mesecon.queue:add_action(pos, "receptor_on", {rules}, nil, rules)
end

function mesecon.receptor_off(self, pos, rules)
if (self.receptor_off) then
print("[Mesecons] Warning: A mod with mesecon support called mesecon:receptor_off.")
print("[Mesecons] If you are the programmer of this mod, please update it ")
print("[Mesecons] to use mesecon.receptor_off instead. mesecon:* is deprecated")
print("[Mesecons] Otherwise, please make sure you're running the latest version")
print("[Mesecons] of that mod and inform the mod creator.")
else
rules = pos
pos = self
end
mesecon.queue:add_action(pos, "receptor_off", {rules}, nil, rules)
end
-- Ugly hack to prevent breaking compatibility with other mods
-- Just remove the following two functions to delete the hack, to be done when other mods have updated
function mesecon.receptor_on(self, pos, rules)
if (self.receptor_on) then
print("[Mesecons] Warning: A mod with mesecon support called mesecon:receptor_on.")
print("[Mesecons] If you are the programmer of this mod, please update it ")
print("[Mesecons] to use mesecon.receptor_on instead. mesecon:* is deprecated")
print("[Mesecons] Otherwise, please make sure you're running the latest version")
print("[Mesecons] of that mod and inform the mod creator.")
else
rules = pos
pos = self
end
mesecon.queue:add_action(pos, "receptor_on", {rules}, nil, rules)
end

function mesecon.receptor_off(self, pos, rules)
if (self.receptor_off) then
print("[Mesecons] Warning: A mod with mesecon support called mesecon:receptor_off.")
print("[Mesecons] If you are the programmer of this mod, please update it ")
print("[Mesecons] to use mesecon.receptor_off instead. mesecon:* is deprecated")
print("[Mesecons] Otherwise, please make sure you're running the latest version")
print("[Mesecons] of that mod and inform the mod creator.")
else
rules = pos
pos = self
end
mesecon.queue:add_action(pos, "receptor_off", {rules}, nil, rules)
end

2 comments on commit 4bd9d2a

@ShadowNinja

This comment has been minimized.

Copy link
Member

@ShadowNinja ShadowNinja replied Dec 15, 2014

Why was the anti-flood feature removed?

@Jeija

This comment has been minimized.

Copy link
Collaborator

@Jeija Jeija replied Dec 16, 2014

That's because you might want to have debug output when playing locally and because there is a problem in the logic of it:
If you suppress output, this behaviour is unexpected and needs to be explained to the user. Therefore, there has to be a log message saying that flooding is prevented and where this can be changed. This debug message, however, floods the console just as well. So it didn't actually make a difference.
The idea was pretty good, but I don't see a sane way to implement it so that server consoles won't be flooded and that print behaviour still is logical. The recommended way for server owners that want to prevent flooding is to just completely remove the print() command, users can't see that output anyways.

Please sign in to comment.
You can’t perform that action at this time.