Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rising water drawOver checkbox #663

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1816,9 +1816,9 @@ rightclicktype["iciclebig"] = {
}

rightclicktype["risingwater"] = {
--region, type, fill, fill speed, link power, link reverse
--region, type, fill, fill speed, on top, link power, link reverse
name = "risingwater",
default = "1|1|0|0|water|1|3|false|.5",
default = "1|1|0|0|water|1|3|false|.5|false",
regionfunc = function(w,h,x,y) --setting region vars
rightclickvalues2[1] = w
rightclickvalues2[2] = h
Expand All @@ -1828,14 +1828,15 @@ rightclicktype["risingwater"] = {
format = {
{"button", 1, {" set area ", function(var, step) startrcregion(var, step) end, {1, 2}}},
"type:",
{"dropdown", 5, 11, nil, {"clear water", "water", "poison", "poison water", "lava", "quicksand", "quicksandtop"}},
{"dropdown", 5, 11, nil, {"clear water", "water", "poison", "poison water", "lava", "quicksand"}},
"fill:",
{"slider", 6, range = {0, 1, round = 5}},
"fill speed:",
{"slider", 7, range = {0, 10, round = 3}},
{"checkbox", 8, "oscillate"},
"wait time:",
{"slider", 9, range = {0, 10, round = 2}},
{"checkbox", 10, "on top"},
{"button", 2, {"link power ", startrclink, {"power", "power"}}, {"x", resetrclink, {"power"}, textcolor = {255, 0, 0}}},
{"button", 2, {"link reverse", startrclink, {"reverse", "reverse"}}, {"x", resetrclink, {"reverse"}, textcolor = {255, 0, 0}}}
},
Expand Down
16 changes: 4 additions & 12 deletions risingwater.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function risingwater:init(x, y, r)
if #self.r > 0 and self.r[1] ~= "link" then
--rightclick things
if self.r[1]:find("|") then
local v = convertr(self.r[1], {"num", "num", "num", "num", "string", "num", "num", "bool", "num"})
local v = convertr(self.r[1], {"num", "num", "num", "num", "string", "num", "num", "bool", "num", "bool"})
self.rx = (self.cox-1)+v[3]
self.ry = (self.coy-1)+v[4]
self.rw = v[1]
Expand All @@ -22,10 +22,12 @@ function risingwater:init(x, y, r)
self.fillspeed = v[7]/self.rh
self.oscillate = v[8]
self.waittime = v[9]
self.ontop = v[10]
end
table.remove(self.r, 1)
end

self.drawover = self.ontop
self.x = self.rx
self.y = self.ry
self.width = self.rw
Expand All @@ -38,31 +40,21 @@ function risingwater:init(x, y, r)

if self.t == "clear water" then
self.quadi = 1
self.drawover = true
self.animdelay = 0.2
elseif self.t == "water" then
self.quadi = 2
self.drawover = false
self.animdelay = 0.2
elseif self.t == "poison" then
self.quadi = 3
self.drawover = true
self.animdelay = 0.2
elseif self.t == "poison water" then
self.quadi = 3
self.drawover = false
self.animdelay = 0.2
elseif self.t == "lava" then
self.quadi = 4
self.drawover = true
self.animdelay = 0.2
elseif self.t == "quicksand" then
self.quadi = 5
self.drawover = false
self.animdelay = 0.2
elseif self.t == "quicksandtop" then
elseif self.t == "quicksand" or self.t == "quicksandtop" then
self.quadi = 5
self.drawover = true
self.animdelay = 0.2
end

Expand Down