First commit 🎉
This commit is contained in:
commit
43ea213f9b
728 changed files with 37080 additions and 0 deletions
|
@ -0,0 +1,45 @@
|
|||
@tool
|
||||
extends "res://addons/popochiu/editor/popups/create_object/create_room_object.gd"
|
||||
## Allows you to create a new Region for a room.
|
||||
|
||||
var _new_region_name := ""
|
||||
var _factory: PopochiuRegionFactory
|
||||
|
||||
|
||||
#region Godot ######################################################################################
|
||||
func _ready() -> void:
|
||||
_group_folder = "regions"
|
||||
_info_files = _info_files.replace("&t", "region")
|
||||
|
||||
super()
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Virtual ####################################################################################
|
||||
func _create() -> Object:
|
||||
if _new_region_name.is_empty():
|
||||
error_feedback.show()
|
||||
return null
|
||||
|
||||
# Setup the region helper and use it to create the region --------------------------------------
|
||||
_factory = PopochiuRegionFactory.new()
|
||||
var param := PopochiuRegionFactory.PopochiuRegionFactoryParam.new()
|
||||
param.obj_name = _new_region_name
|
||||
param.room = _room
|
||||
|
||||
if _factory.create(param) != ResultCodes.SUCCESS:
|
||||
# TODO: show a message in the popup!
|
||||
return null
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
|
||||
return _factory.get_obj_scene()
|
||||
|
||||
|
||||
func _set_info_text() -> void:
|
||||
_new_region_name = _name.to_snake_case()
|
||||
_target_folder = _group_folder % _new_region_name
|
||||
info.text = _info_text.replace("&n", _new_region_name)
|
||||
|
||||
|
||||
#endregion
|
|
@ -0,0 +1 @@
|
|||
uid://dwjd4cv7i2mh
|
|
@ -0,0 +1,13 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://crtkojrvhklpp"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c1pfl2gwjjot5" path="res://addons/popochiu/editor/popups/create_object/create_object.tscn" id="1_haco6"]
|
||||
[ext_resource type="Script" path="res://addons/popochiu/editor/popups/create_object/create_region/create_region.gd" id="2_ft6um"]
|
||||
|
||||
[node name="CreateRegionConfirmation" instance=ExtResource("1_haco6")]
|
||||
script = ExtResource("2_ft6um")
|
||||
|
||||
[node name="Label" parent="PanelContainer/VBoxContainer/InputContainer" index="0"]
|
||||
text = "Region name:"
|
||||
|
||||
[node name="Guide" parent="PanelContainer/VBoxContainer" index="3"]
|
||||
text = "Use a descriptive name in PascalCase (e.g. Sand, StickyFloor)."
|
Loading…
Add table
Add a link
Reference in a new issue