It's Cow Game! Version 2.04!
This commit is contained in:
commit
a9e1ed9ddd
3148 changed files with 95332 additions and 0 deletions
87
Interactions/Arson/Arsonable.gd
Normal file
87
Interactions/Arson/Arsonable.gd
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
extends Interaction
|
||||
|
||||
var fireScene = preload("res://Skills/Arson/Fire.tscn")
|
||||
var smokeScene = preload("res://Skills/Arson/Smoke.tscn")
|
||||
|
||||
@export var ashItemClass:Resource
|
||||
|
||||
@export var flammability = 0
|
||||
@export var weight = 0
|
||||
|
||||
var ashDropLocation:Vector2
|
||||
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
var flintSoundPlayer
|
||||
var lastSoundIndex = -1
|
||||
var flintSounds = []
|
||||
|
||||
func _ready():
|
||||
add_action("Burn", burn)
|
||||
initialize_flint_sounds()
|
||||
|
||||
func initialize_flint_sounds():
|
||||
flintSoundPlayer = $FlintSounds
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint1.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint2.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint3.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint4.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint5.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint6.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint7.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint8.mp3"))
|
||||
|
||||
func burn():
|
||||
play_flint_sound()
|
||||
|
||||
if "item" in get_parent():
|
||||
flammability = get_parent().item.flammability
|
||||
weight = get_parent().item.weight
|
||||
|
||||
var fireChance = LevelManager.get_skill("arson").get_ignition_chance_by_stats(flammability, weight)
|
||||
if rng.randf_range(0, 100) <= fireChance:
|
||||
light_up()
|
||||
get_tree().call_group("FlagManager", "Arsoned")
|
||||
elif fireChance >= 0.5:
|
||||
smoke()
|
||||
|
||||
func play_flint_sound():
|
||||
var newIndex = rng.randi_range(0, flintSounds.size() - 1)
|
||||
|
||||
if newIndex == lastSoundIndex:
|
||||
newIndex = rng.randi_range(0, flintSounds.size() - 1)
|
||||
|
||||
flintSoundPlayer.stream = flintSounds[newIndex]
|
||||
flintSoundPlayer.play()
|
||||
lastSoundIndex = newIndex
|
||||
|
||||
func light_up():
|
||||
GlobalEvents.itemBurnt.emit(get_parent().item)
|
||||
|
||||
var newFire = fireScene.instantiate()
|
||||
newFire.set_item_burning(get_parent().item)
|
||||
|
||||
AchievementManager.burn_achievement_checks(get_parent().item)
|
||||
|
||||
var target_global_pos = get_parent().global_position + Vector2(0, 5)
|
||||
get_parent().get_parent().add_child(newFire)
|
||||
newFire.global_position = target_global_pos
|
||||
|
||||
newFire.set_item_burning(get_parent().item)
|
||||
|
||||
if get_parent() == GameVariables.player.currentInteractingGroundItem:
|
||||
GameVariables.player.change_state("Idle")
|
||||
|
||||
get_parent().queue_free()
|
||||
|
||||
func smoke():
|
||||
var newSmoke = smokeScene.instantiate()
|
||||
newSmoke.position = position + Vector2(0, -20)
|
||||
newSmoke.emitting = true
|
||||
get_parent().add_child(newSmoke)
|
||||
|
||||
func generate_ash():
|
||||
if ashItemClass == null:
|
||||
var baseItem = get_parent().item
|
||||
var ash = AshGenerator.generate_ash(baseItem)
|
||||
get_parent().set_item(ash)
|
||||
14
Interactions/Arson/arsonable.tscn
Normal file
14
Interactions/Arson/arsonable.tscn
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://twerpkipa0v8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_sas5q"]
|
||||
[ext_resource type="Script" path="res://Interactions/Arson/Arsonable.gd" id="2_iex02"]
|
||||
|
||||
[node name="Arsonable" instance=ExtResource("1_sas5q")]
|
||||
script = ExtResource("2_iex02")
|
||||
ashItemClass = null
|
||||
flammability = 0
|
||||
weight = 0
|
||||
|
||||
[node name="FlintSounds" type="AudioStreamPlayer2D" parent="." index="1"]
|
||||
max_distance = 400.0
|
||||
bus = &"SFX"
|
||||
BIN
Interactions/Arson/fire.png
Normal file
BIN
Interactions/Arson/fire.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
34
Interactions/Arson/fire.png.import
Normal file
34
Interactions/Arson/fire.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dkpoh87sg45k2"
|
||||
path="res://.godot/imported/fire.png-6196b70097a88fd173a19acc5ecf6a1c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Interactions/Arson/fire.png"
|
||||
dest_files=["res://.godot/imported/fire.png-6196b70097a88fd173a19acc5ecf6a1c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Loading…
Add table
Add a link
Reference in a new issue