32 lines
739 B
Plaintext
32 lines
739 B
Plaintext
|
---
|
||
|
--- Generated by EmmyLua(https://github.com/EmmyLua)
|
||
|
--- Created by Whimsical.
|
||
|
--- DateTime: 2020-09-26 5:50 p.m.
|
||
|
---
|
||
|
|
||
|
---@param index number
|
||
|
---@param player_color string
|
||
|
function onScriptingButtonDown(index, player_color)
|
||
|
if not (index>=1 and index<=3) then return end
|
||
|
|
||
|
local count = index * 3
|
||
|
|
||
|
---@type Player
|
||
|
local player = Player[player_color]
|
||
|
local object = player:getHoverObject()
|
||
|
|
||
|
|
||
|
if (not object) then return end
|
||
|
if (object.tag~="Deck") then return end
|
||
|
if (count >= object:getQuantity()) then return end
|
||
|
|
||
|
for _ =1, count do
|
||
|
local target_position = object:positionToWorld(Vector(0, 0, -3.5))
|
||
|
|
||
|
object:takeObject {
|
||
|
index = 0,
|
||
|
position = target_position,
|
||
|
smooth = false
|
||
|
}
|
||
|
end
|
||
|
end
|