diff --git a/compass_arrow.svg b/compass_arrow.svg new file mode 100644 index 0000000..aeb1061 --- /dev/null +++ b/compass_arrow.svg @@ -0,0 +1,65 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/init.lua b/init.lua index f94b651..8b6c162 100644 --- a/init.lua +++ b/init.lua @@ -98,7 +98,8 @@ local function hide_hud_waypoint(player) local player_name = player:get_player_name() local hud = player_waypoints[player_name] player_waypoints[player_name] = nil - hud:hide(player) + hud.waypoint:hide(player) + player:hud_remove(hud.background) end @@ -120,6 +121,13 @@ local function show_hud_waypoint(player, compass_item_meta) local size = {x=-9, y=-16} local alignment = {x=100/9*1.47,y=100/16*1.63} -- near compass in your hand + + local background = player:hud_add({ + hud_elem_type = "image", + scale = size, + text = "waypoint_compass_background.png", + alignment = alignment, + }) local waypoint = waypoint_lib.WaypointHUD:new(player, waypoint_pos, waypoint_name, waypoint_color, @@ -134,7 +142,7 @@ local function show_hud_waypoint(player, compass_item_meta) player_name .. " got their HUD stuck on screen?") end - player_waypoints[player_name] = waypoint + player_waypoints[player_name] = {waypoint = waypoint, background = background} end @@ -151,7 +159,7 @@ local function update_hud_waypoint(player, itemstack, force) local waypoint_pos = get_compass_meta_pos(meta) -- remove different waypoint if it exists if player_waypoints[player_name] and - (player_waypoints[player_name].point_pos ~= waypoint_pos + (player_waypoints[player_name].waypoint.point_pos ~= waypoint_pos or force or not get_compass_meta_is_set(meta)) then diff --git a/make_compass_textures.sh b/make_compass_textures.sh new file mode 100644 index 0000000..f51068b --- /dev/null +++ b/make_compass_textures.sh @@ -0,0 +1,9 @@ +input="compass_arrow.svg" +size=64 +angles=9 +for rot in `seq 0 $((angles - 1))`; do + #inkscape -w ${size} -h ${size} compass_arrow.svg -o "$out" + angle=$((90 / angles * rot)) + out="textures/waypoint_compass_arrow_"$(printf "%03d" $angle)".png" + convert -density 384 -background none -distort SRT $angle -gravity center -resize ${size}x${size} "$input" "$out" +done diff --git a/textures/waypoint_compass_arrow_000.png b/textures/waypoint_compass_arrow_000.png index 93a79f8..ef1a3e7 100644 Binary files a/textures/waypoint_compass_arrow_000.png and b/textures/waypoint_compass_arrow_000.png differ diff --git a/textures/waypoint_compass_arrow_010.png b/textures/waypoint_compass_arrow_010.png index 5a93302..7427c8d 100644 Binary files a/textures/waypoint_compass_arrow_010.png and b/textures/waypoint_compass_arrow_010.png differ diff --git a/textures/waypoint_compass_arrow_020.png b/textures/waypoint_compass_arrow_020.png index 2e3314e..47fddb9 100644 Binary files a/textures/waypoint_compass_arrow_020.png and b/textures/waypoint_compass_arrow_020.png differ diff --git a/textures/waypoint_compass_arrow_030.png b/textures/waypoint_compass_arrow_030.png index 933660b..e5c10a9 100644 Binary files a/textures/waypoint_compass_arrow_030.png and b/textures/waypoint_compass_arrow_030.png differ diff --git a/textures/waypoint_compass_arrow_040.png b/textures/waypoint_compass_arrow_040.png index 0638941..a4ede15 100644 Binary files a/textures/waypoint_compass_arrow_040.png and b/textures/waypoint_compass_arrow_040.png differ diff --git a/textures/waypoint_compass_arrow_050.png b/textures/waypoint_compass_arrow_050.png index be52a61..e1826b1 100644 Binary files a/textures/waypoint_compass_arrow_050.png and b/textures/waypoint_compass_arrow_050.png differ diff --git a/textures/waypoint_compass_arrow_060.png b/textures/waypoint_compass_arrow_060.png index a50a7b6..553c0bd 100644 Binary files a/textures/waypoint_compass_arrow_060.png and b/textures/waypoint_compass_arrow_060.png differ diff --git a/textures/waypoint_compass_arrow_070.png b/textures/waypoint_compass_arrow_070.png index 2bb7a8c..aac1a14 100644 Binary files a/textures/waypoint_compass_arrow_070.png and b/textures/waypoint_compass_arrow_070.png differ diff --git a/textures/waypoint_compass_arrow_080.png b/textures/waypoint_compass_arrow_080.png index 22fdd12..f0c0e94 100644 Binary files a/textures/waypoint_compass_arrow_080.png and b/textures/waypoint_compass_arrow_080.png differ diff --git a/textures/waypoint_compass_background.png b/textures/waypoint_compass_background.png new file mode 100644 index 0000000..f98782a Binary files /dev/null and b/textures/waypoint_compass_background.png differ