Broken pos
This commit is contained in:
parent
11d928c4f3
commit
3af13d0a8b
24 changed files with 304 additions and 146 deletions
|
@ -1,9 +1,15 @@
|
|||
extends Node
|
||||
extends StructureBehaviour
|
||||
|
||||
const test_item :=preload("res://generic/items/dbg_item.tres")
|
||||
const inp1 := preload("res://generic/items/dbg_input1.tres")
|
||||
const inp2 := preload("res://generic/items/dbg_input2.tres")
|
||||
const out := preload("res://generic/items/dbg_output.tres")
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
for point in [Vector2(-1,0),Vector2(1,0),Vector2(0,1),Vector2(0,-1)]:
|
||||
var found_structure :Structure = get_parent().get_relative(point)
|
||||
if found_structure and found_structure.inventory:
|
||||
found_structure.inventory.add_from_side(Stack.new(test_item,randi_range(1,test_item.stack_size)),Structure.facing_to_vector(found_structure.facing).angle_to(point))
|
||||
try_add(Vector2.UP,Stack.new(inp1,1))
|
||||
try_add(Vector2.DOWN,Stack.new(inp2,1))
|
||||
try_add(Vector2.RIGHT,Stack.new(out,1))
|
||||
|
||||
func try_add(dir: Vector2,stack : Stack):
|
||||
var found = structure_parent.get_relative(dir)
|
||||
if found != null:
|
||||
found.inventory.add(stack)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue