mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Now world generator's resources inherit from a new base resource.
This commit is contained in:
parent
3524c3bf7f
commit
e44d367c0e
@ -1,10 +1,11 @@
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
var WorldGenWorld = preload("res://addons/world_generator/resources/world_gen_world.gd")
|
||||
var Continent = preload("res://addons/world_generator/resources/continent.gd")
|
||||
var Zone = preload("res://addons/world_generator/resources/zone.gd")
|
||||
var SubZone = preload("res://addons/world_generator/resources/subzone.gd")
|
||||
var SWorldGenBaseResource = preload("res://addons/world_generator/resources/world_gen_base_resource.gd")
|
||||
var SWorldGenWorld = preload("res://addons/world_generator/resources/world_gen_world.gd")
|
||||
var SContinent = preload("res://addons/world_generator/resources/continent.gd")
|
||||
var SZone = preload("res://addons/world_generator/resources/zone.gd")
|
||||
var SSubZone = preload("res://addons/world_generator/resources/subzone.gd")
|
||||
|
||||
var editor_packed_scene = preload("res://addons/world_generator/ui/MainScreen.tscn")
|
||||
var editor_scene = null
|
||||
@ -12,10 +13,13 @@ var editor_scene = null
|
||||
var tool_button : ToolButton = null
|
||||
|
||||
func _enter_tree():
|
||||
add_custom_type("WorldGenWorld", "Resource", WorldGenWorld, null)
|
||||
add_custom_type("Continent", "Resource", Continent, null)
|
||||
add_custom_type("Zone", "Resource", Zone, null)
|
||||
add_custom_type("SubZone", "Resource", SubZone, null)
|
||||
add_custom_type("WorldGenBaseResource", "Resource", SWorldGenBaseResource, null)
|
||||
#Don't change the base to "WorldGenBaseResource" else it will complain about a non-existant class
|
||||
#Also it works perfectly like this
|
||||
add_custom_type("WorldGenWorld", "Resource", SWorldGenWorld, null)
|
||||
add_custom_type("Continent", "Resource", SContinent, null)
|
||||
add_custom_type("Zone", "Resource", SZone, null)
|
||||
add_custom_type("SubZone", "Resource", SSubZone, null)
|
||||
|
||||
editor_scene = editor_packed_scene.instance()
|
||||
|
||||
@ -23,6 +27,7 @@ func _enter_tree():
|
||||
tool_button.hide()
|
||||
|
||||
func _exit_tree():
|
||||
remove_custom_type("WorldGenBaseResource")
|
||||
remove_custom_type("WorldGenWorld")
|
||||
remove_custom_type("Continent")
|
||||
remove_custom_type("Zone")
|
||||
|
@ -1,6 +1,14 @@
|
||||
tool
|
||||
extends Resource
|
||||
extends "res://addons/world_generator/resources/world_gen_base_resource.gd"
|
||||
class_name Continent
|
||||
|
||||
export(Rect2) var rect : Rect2
|
||||
export(Array) var data : Array
|
||||
export(Array) var zones : Array
|
||||
|
||||
func get_content() -> Array:
|
||||
return zones
|
||||
|
||||
func set_content(arr : Array) -> void:
|
||||
zones = arr
|
||||
|
||||
func setup_property_inspector(inspector) -> void:
|
||||
.setup_property_inspector(inspector)
|
||||
|
@ -1,5 +1,7 @@
|
||||
tool
|
||||
extends Resource
|
||||
extends "res://addons/world_generator/resources/world_gen_base_resource.gd"
|
||||
class_name SubZone
|
||||
|
||||
export(Rect2) var rect : Rect2
|
||||
func setup_property_inspector(inspector) -> void:
|
||||
.setup_property_inspector(inspector)
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
tool
|
||||
extends Resource
|
||||
class_name WorldGenBaseResource
|
||||
|
||||
export(Rect2) var rect : Rect2 = Rect2(0, 0, 1, 1)
|
||||
|
||||
func get_content() -> Array:
|
||||
return Array()
|
||||
|
||||
func set_content(arr : Array) -> void:
|
||||
pass
|
||||
|
||||
func setup_property_inspector(inspector) -> void:
|
||||
inspector.add_slot_line_edit("get_name", "set_name", "Name")
|
@ -1,5 +1,15 @@
|
||||
tool
|
||||
extends Resource
|
||||
extends "res://addons/world_generator/resources/world_gen_base_resource.gd"
|
||||
class_name WorldGenWorld
|
||||
|
||||
export(Array) var data : Array
|
||||
export(Array) var continents : Array
|
||||
|
||||
func get_content() -> Array:
|
||||
return continents
|
||||
|
||||
func set_content(arr : Array) -> void:
|
||||
continents = arr
|
||||
|
||||
func setup_property_inspector(inspector) -> void:
|
||||
.setup_property_inspector(inspector)
|
||||
|
||||
|
@ -1,6 +1,14 @@
|
||||
tool
|
||||
extends Resource
|
||||
extends "res://addons/world_generator/resources/world_gen_base_resource.gd"
|
||||
class_name Zone
|
||||
|
||||
export(Rect2) var rect : Rect2
|
||||
export(Array) var data : Array
|
||||
export(Array) var subzones : Array
|
||||
|
||||
func get_content() -> Array:
|
||||
return subzones
|
||||
|
||||
func set_content(arr : Array) -> void:
|
||||
subzones = arr
|
||||
|
||||
func setup_property_inspector(inspector) -> void:
|
||||
.setup_property_inspector(inspector)
|
||||
|
@ -3,4 +3,7 @@
|
||||
[ext_resource path="res://addons/world_generator/resources/world_gen_world.gd" type="Script" id=1]
|
||||
|
||||
[resource]
|
||||
resource_name = "asdasdss"
|
||||
script = ExtResource( 1 )
|
||||
rect = Rect2( 0, 0, 1, 1 )
|
||||
continents = [ ]
|
||||
|
Loading…
Reference in New Issue
Block a user