mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Convert rocket info and autofill
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user