Skip to content

WorldMapView ​

Inherits: Control

The map itself, for the world map window: the picture of the world with the zones laid over it (the shader world_map.gdshader reads the ZoneMap), the names of the zones, the marker of the party, and the mouse: the zone under the mouse lights up (zone_hovered), a click on it (zone_clicked) is for the window to open its map. view_uv is the part of the map that is shown (the whole of it, or the window of a zone). The map is drawn as a square of the shape of the area it covers, in the middle of this control. Everything it needs is given with set_map.

Variables ​

ZoneMapzone_mapnull
Texture2Dmap_texturenull
Rect2view_uvRect2(0.0, 0.0, 1.0, 1.0):
intfocus_zone0:
inthover_zone0
boolshow_namestrue
Variantparty_positionnull
Vector2party_facingVector2(0.0, -1.0)

Methods ​

voidset_map( p_zone_map: ZoneMap, p_texture: Texture2D )
Rect2get_map_rect()
Vector2uv_at( local_position: Vector2 )
Vector2local_of_world( x: float, z: float )
voidrefresh_party()
inttarget_zone_at( local_position: Vector2 )

Signals ​

zone_hovered( zone_id: int ) ​

zone_clicked( zone_id: int ) ​

Constants ​

  • Shader SHADER = preload("res://addons/chroniclenode/assets/shaders/world_map.gdshader")

Variable descriptions ​

ZoneMap zone_map = null ​

The zones laid over the picture, and the area of the world they (and the picture) cover

Texture2D map_texture = null ​

The picture of the world (null = a flat colour)

Rect2 view_uv = Rect2(0.0, 0.0, 1.0, 1.0): ​

The part of the map that is shown, from 0 to 1 over the whole map (a square, as the map is)

int focus_zone = 0: ​

The zone that is open (0 = the whole world is shown): everything outside it is darker

int hover_zone = 0 ​

The zone the mouse is over, as the window treats it: the zone that lights up and that a click opens

bool show_names = true ​

Draw the names of the zones

Variant party_position = null ​

Where the party is (x, y, z in the world), or null; and the way it faces (a direction on the ground: x, z)

Vector2 party_facing = Vector2(0.0, -1.0) ​

No description yet.

Method descriptions ​

void set_map( p_zone_map: ZoneMap, p_texture: Texture2D ) ​

Gives the map its zones, its picture and the area it shows. The whole map is shown, no zone is open

Rect2 get_map_rect() ​

The square of the control the map is drawn in

Vector2 uv_at( local_position: Vector2 ) ​

The place of the whole map (uv from 0 to 1) that a place of this control shows (outside the map is below 0 or above 1)

Vector2 local_of_world( x: float, z: float ) ​

Where a place of the world is in this control (it can be outside the control)

void refresh_party() ​

Draws the marker of the party again (it moved)

int target_zone_at( local_position: Vector2 ) ​

Which zone the mouse means, for a zone found at a place: in the world view the top zone of the place (its sub-zones come when it is opened); inside a zone the sub-zone of it that holds the place (or the zone itself on its own ground); 0 outside of everything