2022-12-13 14:02:30 -05:00
|
|
|
-- Bundled by luabundle {"version":"1.6.0"}
|
|
|
|
local __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)
|
|
|
|
local loadingPlaceholder = {[{}] = true}
|
|
|
|
|
|
|
|
local register
|
|
|
|
local modules = {}
|
|
|
|
|
|
|
|
local require
|
|
|
|
local loaded = {}
|
|
|
|
|
|
|
|
register = function(name, body)
|
|
|
|
if not modules[name] then
|
|
|
|
modules[name] = body
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
require = function(name)
|
|
|
|
local loadedModule = loaded[name]
|
|
|
|
|
|
|
|
if loadedModule then
|
|
|
|
if loadedModule == loadingPlaceholder then
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if not modules[name] then
|
|
|
|
if not superRequire then
|
|
|
|
local identifier = type(name) == 'string' and '\"' .. name .. '\"' or tostring(name)
|
|
|
|
error('Tried to require ' .. identifier .. ', but no such module has been registered')
|
|
|
|
else
|
|
|
|
return superRequire(name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
loaded[name] = loadingPlaceholder
|
|
|
|
loadedModule = modules[name](require, loaded, register, modules)
|
|
|
|
loaded[name] = loadedModule
|
|
|
|
end
|
|
|
|
|
|
|
|
return loadedModule
|
|
|
|
end
|
|
|
|
|
|
|
|
return require, loaded, register, modules
|
|
|
|
end)(nil)
|
|
|
|
__bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules)
|
|
|
|
require("util/DeckCutter")
|
|
|
|
end)
|
|
|
|
__bundle_register("util/DeckCutter", function(require, _LOADED, __bundle_register, __bundle_modules)
|
2023-04-22 16:56:01 -04:00
|
|
|
-- cut 3 (6) cards from a deck if numpad 1 (2) is pressed
|
2022-03-27 10:12:31 -04:00
|
|
|
function onScriptingButtonDown(index, player_color)
|
2023-04-22 16:56:01 -04:00
|
|
|
if not (index >= 1 and index <= 2) then return end
|
2022-03-27 10:12:31 -04:00
|
|
|
|
2023-04-22 16:56:01 -04:00
|
|
|
local count = index * 3
|
2022-03-27 10:12:31 -04:00
|
|
|
local player = Player[player_color]
|
2023-04-22 16:56:01 -04:00
|
|
|
local object = player.getHoverObject()
|
2022-03-27 10:12:31 -04:00
|
|
|
|
2023-04-22 16:56:01 -04:00
|
|
|
if not object then
|
|
|
|
broadcastToColor("Hover over a deck and try again.", player_color, "Orange")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
if object.tag ~= "Deck" then
|
|
|
|
broadcastToColor("Hover over a deck and try again.", player_color, "Orange")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
if count >= object.getQuantity() then
|
|
|
|
broadcastToColor("Deck is too small to cut " .. count .. " cards.", player_color, "Orange")
|
|
|
|
return
|
|
|
|
end
|
2022-03-27 10:12:31 -04:00
|
|
|
|
2023-04-22 16:56:01 -04:00
|
|
|
local pos = object.positionToWorld(Vector(0, 0, -3.5))
|
|
|
|
for _ = 1, count do
|
|
|
|
object.takeObject {
|
2022-03-27 10:12:31 -04:00
|
|
|
index = 0,
|
2023-04-22 16:56:01 -04:00
|
|
|
position = pos,
|
2022-03-27 10:12:31 -04:00
|
|
|
smooth = false
|
|
|
|
}
|
|
|
|
end
|
2022-12-13 14:02:30 -05:00
|
|
|
end
|
|
|
|
end)
|
|
|
|
return __bundle_require("__root")
|