Add pickups-enabled setting

This commit is contained in:
Sofia 2026-08-03 21:42:34 +03:00
parent 1db75b27cf
commit b8fd6a55fd
7 changed files with 58 additions and 35 deletions

View File

@ -3,19 +3,20 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cox27erh4uq28"
path="res://.godot/imported/str_metalflr3.png-db3d8c40da647ad915fa1b22fce3ffd4.ctex"
path.s3tc="res://.godot/imported/str_metalflr3.png-db3d8c40da647ad915fa1b22fce3ffd4.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://maps/textures/str_metalflr3.png"
dest_files=["res://.godot/imported/str_metalflr3.png-db3d8c40da647ad915fa1b22fce3ffd4.ctex"]
dest_files=["res://.godot/imported/str_metalflr3.png-db3d8c40da647ad915fa1b22fce3ffd4.s3tc.ctex"]
[params]
compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
@ -37,4 +38,4 @@ 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
detect_3d/compress_to=0

View File

@ -3,19 +3,20 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://drdl2mbqb5okx"
path="res://.godot/imported/str_metalflr8.png-8c7a73422910961fddcab67d4ec776e6.ctex"
path.s3tc="res://.godot/imported/str_metalflr8.png-8c7a73422910961fddcab67d4ec776e6.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://maps/textures/str_metalflr8.png"
dest_files=["res://.godot/imported/str_metalflr8.png-8c7a73422910961fddcab67d4ec776e6.ctex"]
dest_files=["res://.godot/imported/str_metalflr8.png-8c7a73422910961fddcab67d4ec776e6.s3tc.ctex"]
[params]
compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
@ -37,4 +38,4 @@ 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
detect_3d/compress_to=0

View File

@ -3,19 +3,20 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bl4vie7uwsri"
path="res://.godot/imported/str_metalgrbl3.png-e3eb428045ed48142ddcfe47e5c2ddf3.ctex"
path.s3tc="res://.godot/imported/str_metalgrbl3.png-e3eb428045ed48142ddcfe47e5c2ddf3.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://maps/textures/str_metalgrbl3.png"
dest_files=["res://.godot/imported/str_metalgrbl3.png-e3eb428045ed48142ddcfe47e5c2ddf3.ctex"]
dest_files=["res://.godot/imported/str_metalgrbl3.png-e3eb428045ed48142ddcfe47e5c2ddf3.s3tc.ctex"]
[params]
compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
@ -37,4 +38,4 @@ 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
detect_3d/compress_to=0

View File

@ -3,19 +3,20 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bhxk5pmugja2l"
path="res://.godot/imported/str_metalpan8.png-eba6b499e686b10431a4b63f54205a08.ctex"
path.s3tc="res://.godot/imported/str_metalpan8.png-eba6b499e686b10431a4b63f54205a08.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://maps/textures/str_metalpan8.png"
dest_files=["res://.godot/imported/str_metalpan8.png-eba6b499e686b10431a4b63f54205a08.ctex"]
dest_files=["res://.godot/imported/str_metalpan8.png-eba6b499e686b10431a4b63f54205a08.s3tc.ctex"]
[params]
compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
@ -37,4 +38,4 @@ 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
detect_3d/compress_to=0

View File

@ -3,19 +3,20 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dfmfvmgbi1wff"
path="res://.godot/imported/str_rotwoodgen3.png-1a246be62dcef3636e849a647d198fc7.ctex"
path.s3tc="res://.godot/imported/str_rotwoodgen3.png-1a246be62dcef3636e849a647d198fc7.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://maps/textures/str_rotwoodgen3.png"
dest_files=["res://.godot/imported/str_rotwoodgen3.png-1a246be62dcef3636e849a647d198fc7.ctex"]
dest_files=["res://.godot/imported/str_rotwoodgen3.png-1a246be62dcef3636e849a647d198fc7.s3tc.ctex"]
[params]
compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
@ -37,4 +38,4 @@ 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
detect_3d/compress_to=0

View File

@ -22,6 +22,11 @@ impl Default for GameOptions {
opts.insert(GameOption::GoalsNeededToWin, GameOptionValue::Number(5.));
opts.insert(GameOption::RespawnTimer, GameOptionValue::Number(5.));
opts.insert(GameOption::SpawnProtection, GameOptionValue::Number(3.));
opts.insert(
GameOption::TelegrenadesAllowed,
GameOptionValue::Boolean(true),
);
opts.insert(GameOption::PickupsAllowed, GameOptionValue::Boolean(true));
Self {
values: opts,
teams: Vec::new(),
@ -60,6 +65,10 @@ impl GameOptions {
}
pub fn is_team_true(&self, team: u8, opt: GameOption) -> bool {
if !self.is_true(opt) {
return false;
}
if let Some(opts) = self.teams.get(team as usize) {
let opt = opts
.values

View File

@ -5,7 +5,10 @@ use godot::{
use serde::{Deserialize, Serialize};
use crate::{
game::Game, map::Map, net::network_manager::NetworkManager, player::IPlayer,
game::{Game, opts::GameOption},
map::Map,
net::network_manager::NetworkManager,
player::IPlayer,
replay::StandaloneReplayManager,
};
@ -145,10 +148,16 @@ impl<T: Pickup> PickupCommon for T {
if let Some(game) = &mut Game::singleton()
&& let Ok(player) = collider.try_dynify::<dyn IPlayer>()
{
game.bind_mut().on_pickup(
self.id().unwrap_or(0),
player.dyn_bind().get_player_id().unwrap_or(0),
);
if game.bind().opts.is_team_true(
game.bind()
.get_player_team(player.dyn_bind().get_player_id().unwrap_or(0)),
GameOption::PickupsAllowed,
) {
game.bind_mut().on_pickup(
self.id().unwrap_or(0),
player.dyn_bind().get_player_id().unwrap_or(0),
);
}
}
}
}