Fix some more stuff

- Rename CameraAPI.Pos to CameraAPI.GetPos
- Change some EmmyLua annotations that are supposedly wrong
- Remove debug printing
- Other small fixes
This commit is contained in:
David Vogel 2022-07-23 17:45:06 +02:00
parent 98dfb5fbb0
commit 98370f6737
5 changed files with 9 additions and 13 deletions

View File

@ -76,7 +76,7 @@ end
---@param viewportCenter Vec2|nil -- Result of `GameGetCameraPos()`. Will be queried automatically if set to nil.
---@return Vec2 window
function Coords:ToWindow(world, viewportCenter)
viewportCenter = viewportCenter or CameraAPI.Pos()
viewportCenter = viewportCenter or CameraAPI.GetPos()
local internalTopLeft, internalBottomRight = self:InternalRect()
local pixelScale = self:PixelScale()
@ -89,7 +89,7 @@ end
---@param viewportCenter Vec2|nil -- Result of `GameGetCameraPos()`. Will be queried automatically if set to nil.
---@return Vec2 world
function Coords:ToWorld(window, viewportCenter)
viewportCenter = viewportCenter or CameraAPI.Pos()
viewportCenter = viewportCenter or CameraAPI.GetPos()
local internalTopLeft, internalBottomRight = self:InternalRect()
local pixelScale = self:PixelScale()

View File

@ -47,12 +47,12 @@ function EntityRemoveComponent(entity_id, component_id) end
function EntityGetAllComponents(entity_id) end
---@param entity_id number
---@param component_type_name string
---@param tag string ""
---@param tag string|nil
---@return number[]|nil component_id
function EntityGetComponent(entity_id, component_type_name, tag) end
---@param entity_id number
---@param component_type_name string
---@param tag string ""
---@param tag string|nil
---@return number|nil component_id
function EntityGetFirstComponent(entity_id, component_type_name, tag) end
---@param entity_id number
@ -358,8 +358,8 @@ function AddMaterialInventoryMaterial(entity_id, material_name, count) end
---@return number material_type
function GetMaterialInventoryMainMaterial(entity_id) end
---@param strength number
---@param x number camera_x
---@param y number camera_y
---@param x number|nil -- Defaults to camera position
---@param y number|nil -- Defaults to camera position
function GameScreenshake(strength, x, y) end
function GameOnCompleted() end
---@param id string

View File

@ -28,7 +28,7 @@ end
---Returns the center position of the viewport in world/virtual coordinates.
---@return Vec2
function CameraAPI.Pos()
function CameraAPI.GetPos()
return Vec2(GameGetCameraPos())
end

View File

@ -42,10 +42,6 @@ package.loaded = package.loaded or {
--os = os,
}
for k, v in pairs(package.loaded) do
print(k, v)
end
---Emulated require function in case the Lua API is restricted.
---It's probably good enough for most usecases.
---@param modName string

View File

@ -92,7 +92,7 @@ end
---
---@param componentTypeName string
---@param tableOfComponentValues string[]|nil
---@param tableOfComponentValues string[]
---@return NoitaComponent|nil
function NoitaEntity:AddComponent(componentTypeName, tableOfComponentValues)
local componentID = EntityAddComponent(self.ID, componentTypeName, tableOfComponentValues)
@ -238,7 +238,7 @@ end
---@return string[]
function NoitaEntity:GetTags()
---@type string
local tagsString = EntityGetTags(self.ID)
local tagsString = EntityGetTags(self.ID) or ""
local result = {}
for tag in tagsString:gmatch('([^,]+)') do
table.insert(result, tag)