summaryrefslogtreecommitdiffstats
path: root/addons/hexgrid
diff options
context:
space:
mode:
Diffstat (limited to 'addons/hexgrid')
-rw-r--r--addons/hexgrid/HexMap.gd20
-rw-r--r--addons/hexgrid/HexMap.png.import31
-rw-r--r--addons/hexgrid/Piece.gd4
-rw-r--r--addons/hexgrid/Piece.png.import31
-rw-r--r--addons/hexgrid/Tile.gd6
-rw-r--r--addons/hexgrid/Tile.png.import31
6 files changed, 60 insertions, 63 deletions
diff --git a/addons/hexgrid/HexMap.gd b/addons/hexgrid/HexMap.gd
index f2a62c7..e1a6591 100644
--- a/addons/hexgrid/HexMap.gd
+++ b/addons/hexgrid/HexMap.gd
@@ -1,7 +1,7 @@
-#warning-ignore-all:integer_division
+@icon('res://addons/hexgrid/HexMap.png')
extends Node
-class_name HexMap, "res://addons/hexgrid/HexMap.png"
+class_name HexMap
enum Orientation { E=1, NE=2, N=4, NW=8, W=16, SW=32, S=64, SE=128 }
@@ -22,13 +22,13 @@ var m : float # dh / dw
var im : float # dw / dh
var tl : int # num of hexes in 2 consecutives rows
-var tile_factory_fct : FuncRef
+var tile_factory_fct : Callable
var angles : Dictionary
var adjacents : Array
var search_count : int
var stack : Array
-func _init(cols : int, rows : int, side : float, v0 : Vector2, vertical : bool, fct : FuncRef) -> void:
+func _init(cols : int, rows : int, side : float, v0 : Vector2, vertical : bool, fct : Callable) -> void:
tile_factory_fct = fct
v = vertical
s = side
@@ -69,7 +69,7 @@ func size() -> int:
# fetch a Tile given it's col;row coordinates
func get_tile(coords : Vector2) -> Tile:
- return tile_factory_fct.call_func(coords, key(coords))
+ return tile_factory_fct.call(coords, key(coords))
# Orientation to degrees
func to_degrees(o : int) -> int:
@@ -84,7 +84,7 @@ func to_orientation(a : float) -> int:
# compute the angle between 2 adjacent Tiles
func angle(from : Tile, to : Tile) -> int:
- var a : float = rad2deg((to.position - from.position).angle()) + DEGREE_ADJ
+ var a : float = rad_to_deg((to.position - from.position).angle()) + DEGREE_ADJ
if a < 0: a += 360
return int(a / 10) * 10
@@ -96,7 +96,7 @@ func opposite(o : int) -> int:
# return the Orientation given to distant Tiles
# Orientation is combined in case of diagonals
func distant_orientation(from : Tile, to : Tile) -> int:
- var a : float = rad2deg((to.position - from.position).angle())
+ var a : float = rad_to_deg((to.position - from.position).angle())
if a < 0: a += 360
a = int(a * 10) / 10.0
for k in angles.keys():
@@ -422,7 +422,7 @@ func possible_moves(piece : Piece, from : Tile, tiles : Array) -> int:
from.search_count = search_count
from.road_march = road_march_bonus > 0
stack.push_back(from)
- while(not stack.empty()):
+ while(not stack.is_empty()):
var src : Tile = stack.pop_back()
if (src.acc + (road_march_bonus if src.road_march else 0)) <= 0: continue
# warning-ignore:return_value_discarded
@@ -462,7 +462,7 @@ func shortest_path(piece : Piece, from : Tile, to : Tile, tiles : Array) -> int
from.search_count = search_count
from.road_march = road_march_bonus > 0
stack.push_back(from)
- while(not stack.empty()):
+ while(not stack.is_empty()):
var src : Tile = stack.pop_back()
if (src == to): break
# warning-ignore:return_value_discarded
@@ -512,7 +512,7 @@ func range_of_influence(piece : Piece, from : Tile, category : int, tiles : Arra
search_count += 1
from.search_count = search_count
stack.push_back(from)
- while(not stack.empty()):
+ while(not stack.is_empty()):
var src : Tile = stack.pop_back()
# warning-ignore:return_value_discarded
_build_adjacents(src.coords)
diff --git a/addons/hexgrid/HexMap.png.import b/addons/hexgrid/HexMap.png.import
index c56b1da..aa99e08 100644
--- a/addons/hexgrid/HexMap.png.import
+++ b/addons/hexgrid/HexMap.png.import
@@ -1,8 +1,9 @@
[remap]
importer="texture"
-type="StreamTexture"
-path="res://.import/HexMap.png-86399ef085f54bb49aa45ad5daebe043.stex"
+type="CompressedTexture2D"
+uid="uid://c7f4krpr86r0y"
+path="res://.godot/imported/HexMap.png-86399ef085f54bb49aa45ad5daebe043.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://addons/hexgrid/HexMap.png"
-dest_files=[ "res://.import/HexMap.png-86399ef085f54bb49aa45ad5daebe043.stex" ]
+dest_files=["res://.godot/imported/HexMap.png-86399ef085f54bb49aa45ad5daebe043.ctex"]
[params]
compress/mode=0
+compress/high_quality=false
compress/lossy_quality=0.7
-compress/hdr_mode=0
-compress/bptc_ldr=0
+compress/hdr_compression=1
compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
process/normal_map_invert_y=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/addons/hexgrid/Piece.gd b/addons/hexgrid/Piece.gd
index e84208f..0085ae7 100644
--- a/addons/hexgrid/Piece.gd
+++ b/addons/hexgrid/Piece.gd
@@ -1,7 +1,7 @@
-#warning-ignore-all:unused_argument
+@icon('res://addons/hexgrid/Piece.png')
extends Node2D
-class_name Piece, "res://addons/hexgrid/Piece.png"
+class_name Piece
# movement points
func get_mp() -> int:
diff --git a/addons/hexgrid/Piece.png.import b/addons/hexgrid/Piece.png.import
index ce53b80..64160d3 100644
--- a/addons/hexgrid/Piece.png.import
+++ b/addons/hexgrid/Piece.png.import
@@ -1,8 +1,9 @@
[remap]
importer="texture"
-type="StreamTexture"
-path="res://.import/Piece.png-5155cac4a0bf7c2a889be85d756a935e.stex"
+type="CompressedTexture2D"
+uid="uid://bqdpgpmurt7r"
+path="res://.godot/imported/Piece.png-5155cac4a0bf7c2a889be85d756a935e.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://addons/hexgrid/Piece.png"
-dest_files=[ "res://.import/Piece.png-5155cac4a0bf7c2a889be85d756a935e.stex" ]
+dest_files=["res://.godot/imported/Piece.png-5155cac4a0bf7c2a889be85d756a935e.ctex"]
[params]
compress/mode=0
+compress/high_quality=false
compress/lossy_quality=0.7
-compress/hdr_mode=0
-compress/bptc_ldr=0
+compress/hdr_compression=1
compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
process/normal_map_invert_y=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/addons/hexgrid/Tile.gd b/addons/hexgrid/Tile.gd
index b9463eb..ac94584 100644
--- a/addons/hexgrid/Tile.gd
+++ b/addons/hexgrid/Tile.gd
@@ -1,7 +1,7 @@
-#warning-ignore-all:unused_argument
+@icon('res://addons/hexgrid/Tile.png')
extends Node2D
-class_name Tile, "res://addons/hexgrid/Tile.png"
+class_name Tile
var coords : Vector2
var blocked : bool
@@ -18,7 +18,7 @@ func configure(p : Vector2, c: Vector2, o :Array) -> void:
coords = c
on_map = true
for t in o:
- var s :Sprite = Sprite.new()
+ var s :Sprite2D = Sprite2D.new()
s.texture = load(t)
s.visible = false
add_child(s)
diff --git a/addons/hexgrid/Tile.png.import b/addons/hexgrid/Tile.png.import
index 5c045cc..13c2e53 100644
--- a/addons/hexgrid/Tile.png.import
+++ b/addons/hexgrid/Tile.png.import
@@ -1,8 +1,9 @@
[remap]
importer="texture"
-type="StreamTexture"
-path="res://.import/Tile.png-c201d199cb1cc344924999eb46a6ca7d.stex"
+type="CompressedTexture2D"
+uid="uid://n0h0bofsf177"
+path="res://.godot/imported/Tile.png-c201d199cb1cc344924999eb46a6ca7d.ctex"
metadata={
"vram_texture": false
}
@@ -10,26 +11,24 @@ metadata={
[deps]
source_file="res://addons/hexgrid/Tile.png"
-dest_files=[ "res://.import/Tile.png-c201d199cb1cc344924999eb46a6ca7d.stex" ]
+dest_files=["res://.godot/imported/Tile.png-c201d199cb1cc344924999eb46a6ca7d.ctex"]
[params]
compress/mode=0
+compress/high_quality=false
compress/lossy_quality=0.7
-compress/hdr_mode=0
-compress/bptc_ldr=0
+compress/hdr_compression=1
compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
process/normal_map_invert_y=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1