New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quality of Life Improvements: Bomb Info + Misc #64
base: master
Are you sure you want to change the base?
Conversation
Hey, I like the idea, to make the bomb info draggable, but I don't like to have it rendered as window contently. |
I didn't experience that. As for the background is it possible to change the imgui style background to a higher opacity. (I'm not really experienced in ImGui to know how) |
@WolverinDEV what changes should I make? |
I'm not 100 % sure if the best solution is to make the bomb info moveable or just to fix #70. |
Alright, well personally I prefer the window- also I believe the ability it adds to move it around will fix any issues that arise from having a fixed position... I will make my pr have more substance though and work on adding whether the bomb was dropped to the bomb info. |
Maybe some more people can give their feedback? 👍 ImGui Window preview |
moveable but transparent background and no bar at the top of it when the menu is closed would be sick |
I was thinking this also- best case. Will check out ImGui source and see if its possible or not... |
2023-10-12.23-24-37.1.mp4Summary
|
Would be nice to have info while bomb is being planted. So i guess you could react faster or expect fake plants. |
Perhaps |
Fixed Conflicts can I please get a review @WolverinDEV |
268e5a7
to
0d076f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey,
thanks for your PR.
In regards to your code, I've left a few comments about stuff I noticed.
I also got some a some general questions:
- Why bomb dropped state?
- Why a defuse kit count?
What is the benefit over individually showing for each player if he has a defuse kit?
I also think, I would just make "Escape Closes UI" always on without any settings option
let game_rules = rules_proxy.m_pGameRules()?.read_schema().unwrap(); | ||
|
||
if game_rules.m_bBombDropped().unwrap_or_default() { | ||
return Ok(Some(C4Info { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does ensure, that C_CSGameRulesProxy
always comes before a potential C_PlantedC4
entity? I'm not sure if or under what circumstances but this may lead to unexpected results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the bomb is dropped it can't be planted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should I do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You first have to loop trough all entities in order to find the C_CSGameRulesProxy
entity.
If found & bomb is dropped, then return C4Info with the dropped state.
If not, try to find the bomb entity and get a state from that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats what Im already doing tho? @WolverinDEV
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for entity_identity in entities.iter() {
let class_name = ctx
.class_name_cache
.lookup(&entity_identity.entity_class_info()?)
.context("class name")?;
// Check if bomb is dropped
if class_name
.map(|name| name == "C_CSGameRulesProxy")
.unwrap_or(false)
{
/* The bomb is dropped. */
let rules_proxy = entity_identity
.entity_ptr::<C_CSGameRulesProxy>()?
.reference_schema()
.context("rules proxy missing")?;
let game_rules = rules_proxy
.m_pGameRules()?
.reference_schema()
.context("game rules missing")?;
();
if game_rules.m_bBombDropped().unwrap_or_default() {
return Ok(Some(C4Info {
bomb_site: 0,
state: C4State::Dropped,
}));
}
}
.....
You can't see if the bomb is dropped if you're ct and not close to it, I thought its nice to have
Its only used for selecting appropriate color for bomb timer if no kits then its safe after 10 seconds but if theres kits its not safe till 5 seconds |
3293088
to
356fa65
Compare
356fa65
to
e2d09a5
Compare
Ahh I missed that one. |
No it didn't I noticed that, is this gonna work: ?
|
You can use |
controller/src/enhancements/bomb.rs
Outdated
} | ||
|
||
pub struct BombInfo { | ||
/// Number of Counter-Terrorists with kit | ||
num_kit: u8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed earlier: ct_has_defuse_kit
defuse.time_remaining, defuse.player_name | ||
), | ||
// Helper Function | ||
fn helper_text_color( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not needed. You can use:
let text_color = if self.local_team == 2 {
color_t
} else {
color_ct
};
and instead use ctx.ui.text_colored(text_color, "My lovely text")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still pending
@@ -10,7 +10,7 @@ pub trait Enhancement { | |||
Ok(false) | |||
} | |||
|
|||
fn render(&self, settings: &AppSettings, ui: &imgui::Ui, view: &ViewController); | |||
fn render(&self, ctx: RenderContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still: Please pass RenderContext as reference: &RenderContext
@@ -124,6 +125,14 @@ pub struct UpdateContext<'a> { | |||
pub globals: Globals, | |||
} | |||
|
|||
#[derive(Clone, Copy)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the Copy
derive when you pass RenderContext
as reference.
I'll work on this soon. |
I couldn't even see it before because of chat being in the way + now its draggable to any place you want.