Added a game_crash entity that allows mappers to crash the game and display a message#523
Added a game_crash entity that allows mappers to crash the game and display a message#523Wikot235 wants to merge 2 commits intomapbase-source:developfrom
Conversation
|
This may come across as more of a personal philosophy than something relating to a specific guideline, but I don't think maps should have the intentional ability to crash the game. The only benevolent use I could see for it is a gag or 4th wall break of some kind, and I don't think that's worth having in Mapbase itself. Source engine games and mods aren't always lightweight, and depending on the context, it can be very inconvenient to have to relaunch them. I briefly considered adding an (also, for future reference, I noticed this file isn't mounted by a VPC, which is needed for new code files. In this case, you would've needed to put it in |
|
Yeah, I agree, the use cases for this entity are very niche, but isn't giving mappers more freedom one of the goals of Mapbase? I just don't understand why we shouldn't give mod makers more freedom over what happens in their maps. Of course, if someone really wants it, they can just add it with a few lines of code, but why make it so much more complicated when we could just have an entity for that? |
|
If you really want to crash the game, there's a |
|
Ngl one of the only times where crashing (with an error message) should be considered a feature when it's done to like make sure the games directory is the correct name But it shouldn't be an entity that can just crash your game because the mapper wanted to, it just seems a bit too niche, and as TeamSpen210 said, there's already a crash command |
This PR adds a new game_crash entity to Mapbase, it allows mappers to crash the game and display a message.
Inputs
Keyvalues
Now, you might be wondering, what is the difference between type 1 and type 2. There is one big problem with the Error() function used in type 1, you can't change the title of the window, as the function declaration is in tier0 (which we don't have access to).
Because of that, I created the type 2, it's using the MessageBoxA function from windows.h, but it's not perfect either, the first thing, is that I can't perfectly replicate the behavior of the Error() function. The Error() function makes the message box appear AFTER the game window is closed, but with MessageBoxA it shows the message box and only after clicking OK it closes the game window. Apart from that, it generates lots of "macro redefinition" warnings. It only works on Windows, on other OS it will fall back to Error(), but I have no idea how Error() behaves on Linux to be honest, so that might be unnecessary.
PR Checklist
developbranch OR targets another branch with a specific goal in mind