Convert rocket info and autofill

This commit is contained in:
Cooldude2606
2025-01-26 00:19:34 +00:00
parent 6f9a062190
commit cc274595c7
8 changed files with 174 additions and 177 deletions

View File

@@ -36,16 +36,18 @@ end
--- @class FlyingText.create_above_entity_param:FlyingText.create_param
--- @field target_entity? LuaEntity The entity to create the text above
--- @field offset? { x: number, y: number } Offset to move the text by
--- Create flying above an entity, overrides the position option of FlyingText.create
--- @param options FlyingText.create_above_entity_param
function FlyingText.create_above_entity(options)
local entity = assert(options.target_entity, "A target entity is required")
local size_y = entity.bounding_box.left_top.y - entity.bounding_box.right_bottom.y
local offset = options.offset or { x = 0, y = 0 }
options.position = {
x = entity.position.x,
y = entity.position.y - size_y * 0.25,
x = offset.x + entity.position.x,
y = offset.y + entity.position.y + size_y * 0.25,
}
FlyingText.create(options)
@@ -53,6 +55,7 @@ end
--- @class FlyingText.create_above_player_param:FlyingText.create_param
--- @field target_player? LuaPlayer The player to create the text above
--- @field offset? { x: number, y: number } Offset to move the text by
--- Create flying above a player, overrides the position option of FlyingText.create
--- @param options FlyingText.create_above_player_param
@@ -60,10 +63,11 @@ function FlyingText.create_above_player(options)
local player = assert(options.target_player, "A target player is required")
local entity = player.character; if not entity then return end
local size_y = entity.bounding_box.left_top.y - entity.bounding_box.right_bottom.y
local offset = options.offset or { x = 0, y = 0 }
options.position = {
x = entity.position.x,
y = entity.position.y - size_y * 0.25,
x = offset.x + entity.position.x,
y = offset.y + entity.position.y + size_y * 0.25,
}
FlyingText.create(options)
@@ -71,6 +75,7 @@ end
--- @class FlyingText.create_as_player_param:FlyingText.create_param
--- @field target_player? LuaPlayer The player to create the text above
--- @field offset? { x: number, y: number } Offset to move the text by
--- Create flying above a player, overrides the position and color option of FlyingText.create
--- @param options FlyingText.create_as_player_param
@@ -78,11 +83,12 @@ function FlyingText.create_as_player(options)
local player = assert(options.target_player, "A target player is required")
local entity = player.character; if not entity then return end
local size_y = entity.bounding_box.left_top.y - entity.bounding_box.right_bottom.y
local offset = options.offset or { x = 0, y = 0 }
options.color = player.chat_color
options.position = {
x = entity.position.x,
y = entity.position.y - size_y * 0.25,
x = offset.x + entity.position.x,
y = offset.y + entity.position.y + size_y * 0.25,
}
FlyingText.create(options)