clone functions
This commit is contained in:
parent
2b36bf19f9
commit
2eb4f33864
2 changed files with 27 additions and 0 deletions
13
port.lua
13
port.lua
|
|
@ -47,6 +47,19 @@ function Port:new(position, rotation, color)
|
|||
return port
|
||||
end
|
||||
|
||||
---@return Port
|
||||
function Port:clone()
|
||||
local port = {
|
||||
position = GridPoint:new( self.position.x, self.position.y ),
|
||||
alignment = self.alignment,
|
||||
scanOffset = self.scanOffset,
|
||||
color = self.color
|
||||
}
|
||||
setmetatable( port, { __index = self } )
|
||||
|
||||
return port
|
||||
end
|
||||
|
||||
function Port:rotateClockwise()
|
||||
self.position.x, self.position.y = -self.position.y, self.position.x
|
||||
self.scanOffset = (self.scanOffset == 1) ~= self.alignment and 1 or 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue