extends RigidBody3D @export var slotdata : InventorySlotPD @export var interactiontext :…
- User
extends RigidBody3D
@export var slot_data : InventorySlotPD @export var interaction_text : String = "Pick up"
func _ready(): self.add_to_group("Persist")
func interact(body): if body.get_parent().inventory_data.pick_up_slot_data(slot_data): body.send_hint(slot_data.inventory_item.icon, slot_data.inventory_item.name + " added to inventory.") Audio.play_sound(slot_data.inventory_item.sound_pickup) queue_free()
func get_item_type() -> int: if slot_data and slot_data.inventory_item: return slot_data.inventory_item.item_type else: return -1
Function to handle persistency and saving
func save(): var node_data = { "filename" : get_scene_file_path(), "parent" : get_parent().get_path(), "slot_data" : slot_data, "item_charge" : slot_data.inventory_item.charge_current, "pos_x" : position.x, "pos_y" : position.y, "pos_z" : position.z, "rot_x" : rotation.x, "rot_y" : rotation.y, "rot_z" : rotation.z,
code} return node_data - Assistant
- User
@icon("res://addons/cogito/Assets/Graphics/Editor/Icon_CogitoObject.svg") extends CogitoObject
Derived from CogitoObject, this class handles additional information for projectiles like lifespan, damage, destroy_on_impact. Some of these are inherited from the Wieldable that spawns this projectile.
class_name CogitoProjectile
Lifespan is being set by the Lifespan timer.
@onready var lifespan = $Lifespan
Damage is being set by the wieldable.
var damage_amount : int = 0
Determine what happens if the projectile hits something. Keep this false for stuff like Arrows. True for stuff like bullets or rockets.
@export var destroy_on_impact : bool = false
Sound that gets played when projectile dies.
@export var sound_on_death : AudioStream
Should the projectile stick to what it hits?
@export var stick_on_impact : bool = false
Array of Scenes that will get spawned on parent position on death.
@export var spawn_on_death : Array[PackedScene] = []
This prevents being able to auto pick up projectiles that have just been fired
@export_range(0.1, 3.0, 0.1, "or_greater") var pick_up_delay: float = 0.5 var can_pick_up: bool = false
var Direction
- Assistant
- User
- Assistant
- User
@icon("res://addons/cogito/Assets/Graphics/Editor/Icon_CogitoCurrency.svg") extends Node class_name CogitoCurrency
Triggered whenever any of the attribute values changes.
signal currency_changed(currency_name:String, value_current:float, value_max:float, has_increased:bool)
Triggered when this attribute current value reaches 0.
signal currency_reached_zero(currency_name:String, value_current:float, value_max:float)
- Assistant