équilibrages, fix et évolutions
* résolution du bug de disparition des items #94 * améliorations définitives dans le camion via compost #88 * ajout de plus d'aléatoire dans le zone de départ * suppression des récompenses de quota (pour l'instant) * équilibrage du gain en graine * ajout de la clarté dans les actions
This commit is contained in:
@@ -35,8 +35,6 @@ func all_plant_types() -> Array[PlantType]:
|
||||
|
||||
func all_machines() -> Array[MachineType]:
|
||||
return [
|
||||
preload("res://entities/interactables/machines/compost/compost_types/energy_compost.tres"),
|
||||
preload("res://entities/interactables/machines/compost/compost_types/seed_compost.tres"),
|
||||
preload("res://entities/interactables/machines/solar_pannel/solar_pannel.tres"),
|
||||
]
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@ class_name PlanetData
|
||||
signal quota_number_updated(quota : int)
|
||||
signal contamination_updated(decontamination_surface : float)
|
||||
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE = 200.
|
||||
const DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE = 50.
|
||||
const DEFAULT_BASE_SIZE = Vector2(2000,2000)
|
||||
const MAX_DEFAULT_CONTAMINATION_ZONE_SURFACE = 3000
|
||||
const DEFAULT_BASE_SIZE = Vector2(1500,1500)
|
||||
|
||||
@export var base_size : Vector2 = Vector2(2000,2000)
|
||||
@export var contamination : TerrainData
|
||||
@@ -19,8 +18,7 @@ func _init(_base_size : Vector2 = DEFAULT_BASE_SIZE):
|
||||
base_size = _base_size
|
||||
contamination = TerrainData.new(base_size)
|
||||
contamination.draw_random_zone(
|
||||
DEFAULT_CONTAMINATION_CENTRAL_ZONE_MAX_SIZE,
|
||||
DEFAULT_CONTAMINATION_CENTRAL_ZONE_MIN_SIZE,
|
||||
MAX_DEFAULT_CONTAMINATION_ZONE_SURFACE,
|
||||
base_size/2
|
||||
)
|
||||
contamination_updated.emit(get_decontamination_surface())
|
||||
@@ -48,7 +46,7 @@ func get_decontamination_coverage() -> float:
|
||||
return contamination.get_value_coverage()
|
||||
|
||||
func get_decontamination_surface() -> float:
|
||||
return contamination.get_value_surface() * 10
|
||||
return contamination.get_value_surface()
|
||||
#endregion
|
||||
|
||||
#region ------------------ Objectives ------------------
|
||||
@@ -81,7 +79,7 @@ func get_quota(n = 0) -> int:
|
||||
50,
|
||||
]
|
||||
|
||||
if n > len(first_quotas):
|
||||
if n >= len(first_quotas):
|
||||
return pow(n, 3)
|
||||
else:
|
||||
return first_quotas[n]
|
||||
|
||||
@@ -16,16 +16,15 @@ func _init(terrain_size : Vector2):
|
||||
)
|
||||
|
||||
func draw_random_zone(
|
||||
zone_max_size : float,
|
||||
zone_min_size : float,
|
||||
zone_max_surface : float,
|
||||
zone_position : Vector2i
|
||||
):
|
||||
var noise: Noise = FastNoiseLite.new()
|
||||
noise.seed = randi()
|
||||
noise.noise_type = FastNoiseLite.TYPE_CELLULAR
|
||||
noise.frequency = 0.001 / UNIT_PER_PIXEL
|
||||
noise.frequency = 0.01
|
||||
|
||||
var noise_image_size : Vector2i = Vector2i.ONE * zone_max_size / UNIT_PER_PIXEL
|
||||
var noise_image_size : Vector2i = Vector2i.ONE * (image_size)
|
||||
var noise_image_center = noise_image_size / 2
|
||||
|
||||
var noise_image = noise.get_image(
|
||||
@@ -34,22 +33,28 @@ func draw_random_zone(
|
||||
1.0,
|
||||
)
|
||||
|
||||
ImageTools.draw_gradient(
|
||||
noise_image,
|
||||
noise_image_center,
|
||||
roundi(zone_min_size / UNIT_PER_PIXEL)
|
||||
)
|
||||
|
||||
ImageTools.draw_gradient(
|
||||
noise_image,
|
||||
noise_image_center,
|
||||
roundi(zone_max_size / UNIT_PER_PIXEL),
|
||||
Color.BLACK,
|
||||
true
|
||||
)
|
||||
|
||||
ImageTools.flatten(noise_image, 0.5)
|
||||
|
||||
ImageTools.draw_circle(
|
||||
noise_image,
|
||||
noise_image_center,
|
||||
80/UNIT_PER_PIXEL,
|
||||
Color.WHITE,
|
||||
)
|
||||
|
||||
var random_step = 1
|
||||
var zone_radius = noise_image_size.x - random_step
|
||||
print(get_value_surface(noise_image))
|
||||
while get_value_surface(noise_image) > zone_max_surface:
|
||||
zone_radius -= random_step
|
||||
ImageTools.draw_circle(
|
||||
noise_image,
|
||||
noise_image_center,
|
||||
zone_radius,
|
||||
Color.BLACK,
|
||||
true
|
||||
)
|
||||
|
||||
image.blit_rect(
|
||||
noise_image,
|
||||
Rect2i(
|
||||
@@ -86,15 +91,15 @@ func get_value(point : Vector2) -> float:
|
||||
).r
|
||||
return 0
|
||||
|
||||
func get_value_coverage() -> float:
|
||||
return ImageTools.get_color_coverage(image)
|
||||
func get_value_coverage(i : Image = image) -> float:
|
||||
return ImageTools.get_color_coverage(i)
|
||||
|
||||
func get_value_surface() -> float:
|
||||
return float(ImageTools.get_color_pixel_count(image)) / UNIT_PER_PIXEL
|
||||
func get_value_surface(i : Image = image) -> float:
|
||||
return float(ImageTools.get_color_pixel_count(i)) * UNIT_PER_PIXEL
|
||||
|
||||
func get_pixel_point(point : Vector2) -> Vector2i:
|
||||
var vec : Vector2 = Vector2(point) / UNIT_PER_PIXEL - Vector2.ONE
|
||||
return Vector2i(
|
||||
roundi(vec.x),
|
||||
roundi(vec.y)
|
||||
roundi(vec.x + 0.5),
|
||||
roundi(vec.y + 0.5)
|
||||
)
|
||||
|
||||
1
common/icons/bucket.svg
Normal file
1
common/icons/bucket.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-bucket"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 7m-8 0a8 4 0 1 0 16 0a8 4 0 1 0 -16 0" /><path d="M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.333 -1 1.246 -4.345 2.737 -10.035a7.45 7.45 0 0 0 .263 -1.965" /></svg>
|
||||
|
After Width: | Height: | Size: 506 B |
43
common/icons/bucket.svg.import
Normal file
43
common/icons/bucket.svg.import
Normal file
@@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bd6qddv5ihkjr"
|
||||
path="res://.godot/imported/bucket.svg-b324d7bdd4f8d0338862c0a1b53a000b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/icons/bucket.svg"
|
||||
dest_files=["res://.godot/imported/bucket.svg-b324d7bdd4f8d0338862c0a1b53a000b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
@@ -22,6 +22,9 @@ func get_energy_used() -> int:
|
||||
func get_usage_zone_radius() -> int:
|
||||
return usage_zone_radius
|
||||
|
||||
func get_usage_object_affected(_i : InspectableEntity) -> bool:
|
||||
return false
|
||||
|
||||
func is_one_time_use():
|
||||
return false
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ func _init(_machine_type : MachineType = null, _machine_level : int = 1):
|
||||
|
||||
func get_item_name() -> String:
|
||||
if machine_type:
|
||||
return machine_type.name + " level " + str(machine_level)
|
||||
return machine_type.name
|
||||
return ""
|
||||
|
||||
func get_description() -> String:
|
||||
|
||||
@@ -25,6 +25,9 @@ func get_energy_used() -> int:
|
||||
func get_usage_zone_radius() -> int:
|
||||
return 30
|
||||
|
||||
func get_usage_object_affected(i : InspectableEntity) -> bool:
|
||||
return i is Plant
|
||||
|
||||
func _init(
|
||||
_plant_type : PlantType = null,
|
||||
_parent_mutation : Array[PlantMutation] = []
|
||||
@@ -43,7 +46,7 @@ func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
return false
|
||||
|
||||
var is_there_a_plant_here = false
|
||||
for area in zone.area.get_overlapping_areas() :
|
||||
for area in zone.get_affected_areas():
|
||||
if area is Plant:
|
||||
is_there_a_plant_here = true
|
||||
|
||||
|
||||
@@ -19,11 +19,14 @@ func get_energy_used() -> int:
|
||||
func get_usage_zone_radius() -> int:
|
||||
return SHOVEL_ZONE_RADIUS
|
||||
|
||||
func get_usage_object_affected(i : InspectableEntity) -> bool:
|
||||
return i is Plant or i is UndergroundLoot
|
||||
|
||||
func use_text() -> String:
|
||||
return "Dig"
|
||||
|
||||
func can_use(_player : Player, zone : Player.ActionZone) -> bool:
|
||||
var areas = zone.area.get_overlapping_areas()
|
||||
var areas = zone.get_affected_areas()
|
||||
for area in areas :
|
||||
if area is Plant or area is UndergroundLoot:
|
||||
return true
|
||||
@@ -31,7 +34,7 @@ func can_use(_player : Player, zone : Player.ActionZone) -> bool:
|
||||
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
dig(
|
||||
zone.area.get_overlapping_areas(),
|
||||
zone.get_affected_areas(),
|
||||
player
|
||||
)
|
||||
|
||||
@@ -42,7 +45,8 @@ func dig(areas: Array[Area2D], player: Player):
|
||||
if area and area is Plant:
|
||||
player.play_sfx("harvest")
|
||||
area.harvest()
|
||||
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
||||
if area and area is UndergroundLoot:
|
||||
player.play_sfx("dig")
|
||||
area.dig()
|
||||
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
||||
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
||||
|
||||
@@ -11,12 +11,12 @@ static func get_color_pixel_count(image: Image, color: Color = Color.WHITE) -> i
|
||||
pixel_color_count += 1.
|
||||
return pixel_color_count
|
||||
|
||||
static func draw_circle(image: Image, center: Vector2i, length: int, color: Color = Color.WHITE):
|
||||
static func draw_circle(image: Image, center: Vector2i, length: int, color: Color = Color.WHITE, inverse = false):
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
var center_distance = Vector2i(x, y).distance_to(center)
|
||||
|
||||
if (center_distance <= length):
|
||||
if not inverse and (center_distance <= length) or inverse and (center_distance > length):
|
||||
image.set_pixel(x, y, color)
|
||||
|
||||
|
||||
|
||||
62
common/vfx/materials/shaders/outline.gdshader
Normal file
62
common/vfx/materials/shaders/outline.gdshader
Normal file
@@ -0,0 +1,62 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform vec4 color : source_color = vec4(1.0);
|
||||
uniform float width : hint_range(0, 10) = 1.0;
|
||||
uniform int pattern : hint_range(0, 2) = 0; // diamond, circle, square
|
||||
uniform bool inside = false;
|
||||
uniform bool add_margins = true; // only useful when inside is false
|
||||
|
||||
void vertex() {
|
||||
if (add_margins) {
|
||||
VERTEX += (UV * 2.0 - 1.0) * width;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasContraryNeighbour(vec2 uv, vec2 texture_pixel_size, sampler2D texture) {
|
||||
for (float i = -ceil(width); i <= ceil(width); i++) {
|
||||
float x = abs(i) > width ? width * sign(i) : i;
|
||||
float offset;
|
||||
|
||||
if (pattern == 0) {
|
||||
offset = width - abs(x);
|
||||
} else if (pattern == 1) {
|
||||
offset = floor(sqrt(pow(width + 0.5, 2) - x * x));
|
||||
} else if (pattern == 2) {
|
||||
offset = width;
|
||||
}
|
||||
|
||||
for (float j = -ceil(offset); j <= ceil(offset); j++) {
|
||||
float y = abs(j) > offset ? offset * sign(j) : j;
|
||||
vec2 xy = uv + texture_pixel_size * vec2(x, y);
|
||||
|
||||
if ((xy != clamp(xy, vec2(0.0), vec2(1.0)) || texture(texture, xy).a <= 0.0) == inside) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec2 uv = UV;
|
||||
|
||||
if (add_margins) {
|
||||
vec2 texture_pixel_size = vec2(1.0) / (vec2(1.0) / TEXTURE_PIXEL_SIZE + vec2(width * 2.0));
|
||||
|
||||
uv = (uv - texture_pixel_size * width) * TEXTURE_PIXEL_SIZE / texture_pixel_size;
|
||||
|
||||
if (uv != clamp(uv, vec2(0.0), vec2(1.0))) {
|
||||
COLOR.a = 0.0;
|
||||
} else {
|
||||
COLOR = texture(TEXTURE, uv);
|
||||
}
|
||||
} else {
|
||||
COLOR = texture(TEXTURE, uv);
|
||||
}
|
||||
|
||||
if ((COLOR.a > 0.0) == inside && hasContraryNeighbour(uv, TEXTURE_PIXEL_SIZE, TEXTURE)) {
|
||||
COLOR.rgb = inside ? mix(COLOR.rgb, color.rgb, color.a) : color.rgb;
|
||||
COLOR.a += (1.0 - COLOR.a) * color.a;
|
||||
}
|
||||
}
|
||||
1
common/vfx/materials/shaders/outline.gdshader.uid
Normal file
1
common/vfx/materials/shaders/outline.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bt4t4qrug135
|
||||
55
common/vfx/materials/shaders/skew.gdshader
Normal file
55
common/vfx/materials/shaders/skew.gdshader
Normal file
@@ -0,0 +1,55 @@
|
||||
// Hey this is Hei! This shader "fakes" a 3D-camera perspective on CanvasItems.
|
||||
// License: MIT
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
// Camera FOV
|
||||
uniform float fov : hint_range(1, 179) = 90;
|
||||
uniform bool cull_back = true;
|
||||
uniform float y_rot : hint_range(-180, 180) = 0.0;
|
||||
uniform float x_rot : hint_range(-180, 180) = 0.0;
|
||||
// At 0, the image retains its size when unrotated.
|
||||
// At 1, the image is resized so that it can do a full
|
||||
// rotation without clipping inside its rect.
|
||||
uniform float inset : hint_range(0, 1) = 0.0;
|
||||
// Consider changing this to a uniform and changing it from code
|
||||
|
||||
varying flat vec2 o;
|
||||
varying vec3 p;
|
||||
|
||||
// Creates rotation matrix
|
||||
void vertex(){
|
||||
float sin_b = sin(y_rot / 180.0 * PI);
|
||||
float cos_b = cos(y_rot / 180.0 * PI);
|
||||
float sin_c = sin(x_rot / 180.0 * PI);
|
||||
float cos_c = cos(x_rot / 180.0 * PI);
|
||||
|
||||
mat3 inv_rot_mat;
|
||||
inv_rot_mat[0][0] = cos_b;
|
||||
inv_rot_mat[0][1] = 0.0;
|
||||
inv_rot_mat[0][2] = -sin_b;
|
||||
|
||||
inv_rot_mat[1][0] = sin_b * sin_c;
|
||||
inv_rot_mat[1][1] = cos_c;
|
||||
inv_rot_mat[1][2] = cos_b * sin_c;
|
||||
|
||||
inv_rot_mat[2][0] = sin_b * cos_c;
|
||||
inv_rot_mat[2][1] = -sin_c;
|
||||
inv_rot_mat[2][2] = cos_b * cos_c;
|
||||
|
||||
|
||||
float t = tan(fov / 360.0 * PI);
|
||||
p = inv_rot_mat * vec3((UV - 0.5), 0.5 / t);
|
||||
float v = (0.5 / t) + 0.5;
|
||||
p.xy *= v * inv_rot_mat[2].z;
|
||||
o = v * inv_rot_mat[2].xy;
|
||||
|
||||
VERTEX += (UV - 0.5) / TEXTURE_PIXEL_SIZE * t * (1.0 - inset);
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
if (cull_back && p.z <= 0.0) discard;
|
||||
vec2 uv = (p.xy / p.z).xy - o;
|
||||
COLOR = texture(TEXTURE, uv + 0.5);
|
||||
COLOR.a *= step(max(abs(uv.x), abs(uv.y)), 0.5);
|
||||
}
|
||||
1
common/vfx/materials/shaders/skew.gdshader.uid
Normal file
1
common/vfx/materials/shaders/skew.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bqjwmomh851lc
|
||||
Reference in New Issue
Block a user