104 lines
2.3 KiB
GDScript
104 lines
2.3 KiB
GDScript
extends NPC
|
|
|
|
var rng = RandomNumberGenerator.new()
|
|
var moveSpeed = 200
|
|
|
|
var waitTimer = 0
|
|
var sitting = false
|
|
var onPhone = false
|
|
|
|
var waited = false
|
|
|
|
func _ready():
|
|
characterName = "Marlow"
|
|
pronouns = "they/them"
|
|
|
|
GlobalEvents.itemBurnt.connect(puppet_burnt)
|
|
GlobalEvents.itemBeheld.connect(puppet_shown)
|
|
GlobalEvents.itemPlayedWith.connect(puppet_shown)
|
|
GlobalEvents.itemWeaved.connect(puppet_weaved)
|
|
|
|
func puppet_burnt(item:Item):
|
|
if item.get_name(false) == "Marlow Puppet":
|
|
MessageManager.addMessage("Destruction is a form of creation.", self, "Marlow", Color.ORANGE_RED)
|
|
|
|
func puppet_shown(item:Item):
|
|
if item.get_name(false) == "Marlow Puppet":
|
|
MessageManager.addMessage("Omg so handsome...! And the puppet is cute too :3", self, "Marlow", Color.ORANGE_RED)
|
|
|
|
func puppet_weaved(item:Item):
|
|
if item.get_name(false) == "Marlow Puppet":
|
|
MessageManager.addMessage("Wow, you're really good at this, you even made it turn pink!", self, "Marlow", Color.ORANGE_RED)
|
|
|
|
func _process(delta):
|
|
waitTimer -= delta
|
|
if waitTimer <= 0:
|
|
if !waited:
|
|
waited = true
|
|
if onPhone:
|
|
$Sprite.play("OnTheyPhone")
|
|
elif sitting:
|
|
$Sprite.play("Sit")
|
|
wait_between_actions()
|
|
else:
|
|
pick_next_action()
|
|
|
|
func wait_between_actions():
|
|
waitTimer = rng.randf_range(0.5, 3)
|
|
|
|
func pick_next_action():
|
|
if onPhone:
|
|
var nextActionResult = rng.randi_range(0, 4)
|
|
if nextActionResult <= 1:
|
|
put_away_phone()
|
|
elif nextActionResult <= 4:
|
|
wait_between_actions()
|
|
elif sitting:
|
|
var nextActionResult = rng.randi_range(0, 4)
|
|
if nextActionResult <= 1:
|
|
stand_up()
|
|
elif nextActionResult <= 3:
|
|
take_out_phone()
|
|
elif nextActionResult <= 4:
|
|
wait_between_actions()
|
|
else:
|
|
var nextActionResult = rng.randi_range(0, 4)
|
|
if nextActionResult <= 1:
|
|
sit_down()
|
|
elif nextActionResult <= 4:
|
|
wait_between_actions()
|
|
|
|
waited = false
|
|
|
|
func sit_down():
|
|
$Sprite.play("SitDown")
|
|
sitting = true
|
|
waitTimer = 1.5
|
|
|
|
func sit():
|
|
$Sprite.play("Sit")
|
|
waitTimer = 3
|
|
|
|
func stand_up():
|
|
$Sprite.play("Stand")
|
|
sitting = false
|
|
waitTimer = 4
|
|
|
|
func walk():
|
|
$Sprite.play("Walk")
|
|
waitTimer = 2
|
|
|
|
func take_out_phone():
|
|
onPhone = true
|
|
$Sprite.play("PhonePullout")
|
|
waitTimer = 1
|
|
|
|
func put_away_phone():
|
|
onPhone = false
|
|
$Sprite.play("PhonePullout")
|
|
waitTimer = 1
|
|
|
|
func on_they_phone():
|
|
$Sprite.play("OnTheyPhone")
|
|
waitTimer = rng.randf_range(2, 5)
|