Skip to content
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

feat: adds a couple of new commands for GMs on games. #6183

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Scoppio
Copy link
Collaborator

@Scoppio Scoppio commented Nov 6, 2024

New commands:

/kill : Kills (ID) unit at GM's discretion, needs to be enabled in the game options.
/nosmoke: clears all smoke clouds in the board.
/weather [...args]: allows the GM to change the weather on demand
/disaster [type]: cast a disaster (like in the old days of SimCity) to spicy things up (WIP)!

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.15%. Comparing base (a7bb1b4) to head (ffe5736).
Report is 10 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6183      +/-   ##
============================================
- Coverage     29.17%   29.15%   -0.03%     
+ Complexity    13971    13969       -2     
============================================
  Files          2628     2636       +8     
  Lines        266564   266772     +208     
  Branches      47575    47594      +19     
============================================
- Hits          77771    77770       -1     
- Misses       184910   185119     +209     
  Partials       3883     3883              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -0,0 +1,131 @@
/*
* Copyright (C) 2024 Luana Scoppio ([email protected])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you claiming copyright of this code? Normally we ask that the code be under the MegaMek team copyright, I believe

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirmed with the team, this isn’t the issue I thought it was, so carry on! :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kinda copied and pasted what were in other files, since this is based directly in an older file that is the same license I tought that adding my name to it to make clear who authored would be reasonable.
But either way, I will review if I didnt forget the megamek team entry in any of the files.

@@ -140,6 +140,8 @@ GameOptionsInfo.option.allow_nukes.displayableName=Allow command-line nukes.
GameOptionsInfo.option.allow_nukes.description=This must be checked to allow players to throw nukes from the command line. If this is not checked, nukes are still available as advanced munitions.
GameOptionsInfo.option.really_allow_nukes.displayableName=REALLY allow command-line nukes.
GameOptionsInfo.option.really_allow_nukes.description=This must be checked to allow players to throw nukes from the command line. If this is not checked, nukes are still available as advanced munitions.
GameOptionsInfo.option.gm_can_kill_units.displayableName=Allow command-line kill (GM only).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest lumping this together with command line nukes. I doubt the distinction is required.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe one new specifically to enable/disable GM commands in game? Because now I have created 4 new GM-only commands, or maybe just not add the option at all, since you are turning yourself into a GM, requesting the blessing of the other players, maybe having access to all commands should be a given instead of having multiple flags blocking you from doing that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I would go with "GM gets access to all GM commands by default". Nominally, the point is to give them access to various tools that let them arbitrarily alter the scenario as needed. The GM status itself already has some safeguards applied to prevent abuse (can't just activate it midgame without the players voting to allow it, etc.).


private void updatePlanetaryCondition(String arg, String prefix, int connId, int maxLength, Consumer<Integer> setter,
Function<Integer, String> successMessage, Function<Integer, String> errorMessage) {
var value = Integer.parseInt(arg.substring(prefix.length()));

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
}
Report.addNewline(vDesc);
}
}
}

private void explosionDamage(Coords position, Vector<Report> vDesc, Entity e, int damage) {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'position' is never used.

// Next, for whatever's left, do terrain effects
// such as clearing, roughing, and boiling off water.
boolean damageFlag = true;

Check notice

Code scanning / CodeQL

Unread local variable Note

Variable 'boolean damageFlag' is never read.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants