Fixed up a couple things, first steps towards a location manager
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
class_name npcConstruct
|
||||
extends cCharacter
|
||||
|
||||
var defaultRoom = 0
|
||||
|
||||
signal location_changed(ai, old_location, new_location)
|
||||
signal state_changed(ai, old_state, new_state)
|
||||
|
||||
var state: int = 0
|
||||
|
||||
func advance_state() -> void:
|
||||
if state >= MAX_STATE:
|
||||
if reset_after_climax:
|
||||
@@ -14,11 +13,10 @@ func advance_state() -> void:
|
||||
else:
|
||||
state += 1
|
||||
|
||||
func _ready():
|
||||
super._ready()
|
||||
func _init():
|
||||
super._init()
|
||||
print("Construct Ready")
|
||||
|
||||
|
||||
Global.game.night.hour_changed.connect(_on_hour_changed)
|
||||
|
||||
func _on_hour_changed(hour: int):
|
||||
@@ -29,6 +27,8 @@ func _on_hour_changed(hour: int):
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
print("Construct: Processing")
|
||||
print(state)
|
||||
|
||||
match state:
|
||||
0: pass # dormant
|
||||
@@ -38,6 +38,7 @@ func _process(delta: float) -> void:
|
||||
4: pass
|
||||
5: pass
|
||||
6: pass
|
||||
|
||||
advance_state()
|
||||
if (randi_range(1, 20) > 10):
|
||||
stunted = true
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class_name cCharacter
|
||||
extends Node
|
||||
|
||||
# --- Parameters ---
|
||||
@export_range(0, 20) var ai_level := 10
|
||||
|
||||
@@ -9,6 +8,8 @@ extends Node
|
||||
@export var reset_after_climax := true
|
||||
@export var character_name := "template"
|
||||
|
||||
var default_room: cCamera = Global.game.cameras[0]
|
||||
|
||||
# --- Constants ---
|
||||
const MAX_STATE := 6
|
||||
const DEBUG := true
|
||||
@@ -25,10 +26,7 @@ func move_to(room_id: int):
|
||||
current_room = room_id
|
||||
Global.rooms[current_room].add_enemy(self)
|
||||
|
||||
func _init():
|
||||
_ready()
|
||||
|
||||
func _ready() -> void:
|
||||
func _init() -> void:
|
||||
randomize()
|
||||
_set_next_interval()
|
||||
|
||||
@@ -54,6 +52,7 @@ func try_move(delta: float) -> bool:
|
||||
return roll <= ai_level
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
print("Test Character Script")
|
||||
if try_move(delta):
|
||||
if(stunted):
|
||||
stunted = false
|
||||
|
||||
Reference in New Issue
Block a user