43 lines
722 B
GDScript
43 lines
722 B
GDScript
@icon("./gear.png")
|
|
class_name Gear extends Node3D
|
|
|
|
var idle_basis = Basis(
|
|
Vector3(1, 0, 0),
|
|
Vector3(0, 1, 0),
|
|
Vector3(0, 0, 1))
|
|
var use_basis = Basis(
|
|
Vector3(1, 0, 0),
|
|
Vector3(0, 0, -1),
|
|
Vector3(0, 1, 0))
|
|
var pickup_basis = idle_basis
|
|
|
|
func gear_name():
|
|
return "Gear"
|
|
func gear_id():
|
|
return 0
|
|
func model_file():
|
|
return "hammer.glb"
|
|
func continuous():
|
|
return false
|
|
|
|
# this can be redefined to make a custom
|
|
# gear mesh, e.g. a SphereMesh
|
|
func use(player):
|
|
basis = use_basis
|
|
$Timer.start()
|
|
on_use(player)
|
|
|
|
func on_use(_player):
|
|
pass
|
|
|
|
func on_ready():
|
|
pass
|
|
|
|
func _on_timer_timeout():
|
|
basis = idle_basis
|
|
|
|
func _ready():
|
|
basis = idle_basis
|
|
if get_parent() is GearPickup:
|
|
basis = pickup_basis
|
|
on_ready()
|