Code formatting

master
Lars Mueller 2022-06-15 15:03:33 +02:00
parent 1db3062a78
commit 7ea2da7e11
3 changed files with 22 additions and 20 deletions

1
.stylua.toml Normal file
View File

@ -0,0 +1 @@
call_parentheses = "None"

View File

@ -17,7 +17,9 @@ end
local function get_texture(hue) local function get_texture(hue)
return ("[combine:%dx256:0,0="):format(256 + bar_width) return ("[combine:%dx256:0,0="):format(256 + bar_width)
.. get_gradient_texture(hue):gsub("[\\^:]", function(char) return "\\" .. char end) -- escape .. get_gradient_texture(hue):gsub("[\\^:]", function(char)
return "\\" .. char
end) -- escape
.. ([[:256,0=epidermis_gradient_hue.png\^[transformR270\^[resize\:%dx256]]):format(bar_width) .. ([[:256,0=epidermis_gradient_hue.png\^[transformR270\^[resize\:%dx256]]):format(bar_width)
end end
@ -54,11 +56,7 @@ local function get_uv(self, user)
end end
local function vector_combine(v, w, func) local function vector_combine(v, w, func)
return vector.new( return vector.new(func(v.x, w.x), func(v.y, w.y), func(v.z, w.z))
func(v.x, w.x),
func(v.y, w.y),
func(v.z, w.z)
)
end end
local function rotate_boxes(self) local function rotate_boxes(self)
@ -68,7 +66,10 @@ local function rotate_boxes(self)
for index_x = 1, 1 + 3, 3 do for index_x = 1, 1 + 3, 3 do
for index_y = 2, 2 + 3, 3 do for index_y = 2, 2 + 3, 3 do
for index_z = 3, 3 + 3, 3 do for index_z = 3, 3 + 3, 3 do
local pos = vector.rotate(vector.new(collisionbox[index_x], collisionbox[index_y], collisionbox[index_z]), rotation) local pos = vector.rotate(
vector.new(collisionbox[index_x], collisionbox[index_y], collisionbox[index_z]),
rotation
)
min = vector_combine(min, pos, math.min) min = vector_combine(min, pos, math.min)
max = vector_combine(max, pos, math.max) max = vector_combine(max, pos, math.max)
end end
@ -77,7 +78,7 @@ local function rotate_boxes(self)
local box = { min.x, min.y, min.z, max.x, max.y, max.z } local box = { min.x, min.y, min.z, max.x, max.y, max.z }
self.object:set_properties { self.object:set_properties {
collisionbox = box, collisionbox = box,
selectionbox = box selectionbox = box,
} }
end end
@ -98,12 +99,12 @@ colorpicker.initial_properties = {
} }
colorpicker.lua_properties = { colorpicker.lua_properties = {
staticdata = "lua" staticdata = "lua",
} }
function colorpicker:_set_hue(hue) function colorpicker:_set_hue(hue)
self._.hue = hue self._.hue = hue
self.object:set_properties({ self.object:set_properties {
textures = { textures = {
"epxb.png", "epxb.png",
"epxb.png", "epxb.png",
@ -112,7 +113,7 @@ function colorpicker:_set_hue(hue)
get_texture(hue), get_texture(hue),
"epxb.png", "epxb.png",
}, },
}) }
end end
function colorpicker:_set_rotation(rotation) function colorpicker:_set_rotation(rotation)
@ -126,7 +127,7 @@ function colorpicker:on_activate()
self:_set_rotation(self._.rotation or vector.new(0, 0, 0)) self:_set_rotation(self._.rotation or vector.new(0, 0, 0))
local object = self.object local object = self.object
object:set_acceleration(vector.new(0, -0.981, 0)) object:set_acceleration(vector.new(0, -0.981, 0))
object:set_armor_groups({ immortal = 1, punch_operable = 1 }) object:set_armor_groups { immortal = 1, punch_operable = 1 }
end end
function colorpicker:_get_color(user) function colorpicker:_get_color(user)

View File

@ -180,7 +180,7 @@ register_color_tool("epidermis:pen", {
entity:_update_texture() entity:_update_texture()
end) end)
-- TODO allow holding these items using a globalstep -- TODO (?) allow holding these items using a globalstep
epidermis.register_tool("epidermis:eraser", { epidermis.register_tool("epidermis:eraser", {
description = "Eraser", description = "Eraser",