Skip to content

Update with more commands, some more functionality, some fixes#195

Open
WolfoIsBestWolf wants to merge 27 commits intoharbingerofme:masterfrom
WolfoIsBestWolf:master
Open

Update with more commands, some more functionality, some fixes#195
WolfoIsBestWolf wants to merge 27 commits intoharbingerofme:masterfrom
WolfoIsBestWolf:master

Conversation

@WolfoIsBestWolf
Copy link
Copy Markdown

Hope more people can get to use this stuff.

If some stuff needs to be changed let me know.

Only known issue; no_cooldowns doesn't work with SS2 due to some old code on their end, not really anything that can be done here.

@SChinchi
Copy link
Copy Markdown
Collaborator

There's a lot here, so it will take time to fully review.

One thing I'll say for now is that I fixed the spawn_as permanency issue a few days and just today I extended spawn_ai to spawn a body for as your ally so give_drone is most likely superfluous.

@WolfoIsBestWolf
Copy link
Copy Markdown
Author

WolfoIsBestWolf commented Dec 31, 2025

Yeah there's quite a lot. Big theme is just ease-of-use hope that's appreciated.

I use stuff like scanner hundreds of times I assume people will like it if they find it.

I'll put "spawn_as" the default to permanent if this was seen as more of a bug fix anyways. Don't know if spawning as something temporarily would see much use but probably fine to have it as a an option.

@SChinchi
Copy link
Copy Markdown
Collaborator

Yeah there's quite a lot. Big theme is just ease-of-use hope that's appreciated.

I use stuff like scanner hundreds of times I assume people will like it if they find it.

It is indeed appreciated. I'm still going through the review and so far there only a few objections on either the implementation of something or whether something should be included. I expect the other members to offer their opinion if there is a disagreement, so don't take everything I say at face value. But brace yourself for A LOT of comments, mainly for code quality and some minor issues. I might leave some classes for a second round of reviewing just so I can get the rest to you in a prompt manner.

I'll put "spawn_as" the default to permanent if this was seen as more of a bug fix anyways. Don't know if spawning as something temporarily would see much use but probably fine to have it as a an option.

Yep, it was just one-line bug fix. Just because an extra option is now available, it doesn't always mean it adds any real value if it's too niche. Scope creep vs simplicity/functionality and all.

Copy link
Copy Markdown
Collaborator

@SChinchi SChinchi left a comment

Choose a reason for hiding this comment

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

I'm submitting this review as general feedback, but there are some issues that should be addressed before merging. For the record the following classes have not been thoroughly reviewed as I lack the time and the mental energy at the moment. Expect a follow-up in a few days:

  • Buffs
  • Items
  • PlayerCommands
  • Hooks
  • Lang
  • StringFinder

@WolfoIsBestWolf
Copy link
Copy Markdown
Author

Removed duplicate 'list_drones' & 'give_drone'
Removed duplicate 'set_health'
Removed various uneeded server, null body null master checks.
Removed amount limiter for relevant 3 commands
Removed various commented out stuff

Returned GIVEOBJECT, 'droptable'
The CollectEnumNames for item_types & pickup_types

'Kill_all' default now just calls 'kill_all 2' & '4' instead of doubled code.

'no_interactables' now works with simu

'dtpeace' now does 'god 1'

Now getting modded CSCs for list_directorcards the same way.

'evolve_lemurians [target (player|'all'):]' & making command in line with rest of mod.
'hide_model' null checks to make in line with rest of mod.

'kill_all_minions' now says it works with pinged
'remove_all_drones' now says it works with pinged

fixed 'rich/poor' getting player from wrong arg

Renamed 'list_mods' to 'dump_mods', proper help, removed args.
Renamed 'hud' to 'toggle_hud'.

'give_void' no longer subtracts below 0
'give_void' merged into 'give_lunar'

Removed 'scanner' unneed alliteration
Removed 'peace' unneed alliteration
Removed 'nocooldown' unneed alliteration
Removed 'evolve_lemurian' unneed alliteration
Removed 'invulenemy' unneed alliteration
Removed 'ui' unneed alliteration
Removed 'invis' unneed alliteration

Reverted 'spawn_as' addition of 'permanent' argument for being too, unneeded.
Removed 'true_kill' argument from 'kill_all'
Removed 'true_kill_all'
'true_kill' now supports 'pinged' and 'all'

Added 'godenemy' for parrity with 'buddhaenemy', even if use case is beyond me.
Both now check for 'TeamIndex.Monster'

Fixed altered crit not being reset by 'reset_stats'
Fixed level being set there too oops.

'spawn_interactable' amount now gotten same way other amounts are gotten in mod

Reblocked vanilla 'timescale', wasn't meant to go through.

GetDrone & GetPickup from partial documentation.

'give_equip -1' now shows in auto complete.

'goto_boss' no longer usable outside of run, no longer has wrong help.

Made default 'random_items' weighted like the vanilla randomitems method

cleaner code this way.
also added same support for 'remove_buff'
calls the other commands now.

Apparently 'removed_all_buffs 0' is also just broken with ss2 at least with beta. Not sure what to do about that
This should help if testing smth like how does it work on eclipse vs other difficulty.

Does mean the mod needs to depend on R2API_Difficulty.
-For modded difficulties
-For DifficultyDef to DifficutlyIndex (not invanilla I think)
Do think this is still a good command to have.

Fixed Parse.BuffTarget 'pinged' returning wrong fail message if it fails.
dtdamage: Too plain

unlimited_junk: Too specific to need a toggle.

kill_all_minions: Seems a bit too specific, I use kill_all 1 all the time I wouldn't switch over to this.. But remove_all_drones is good.
Changed 'create_pickup' [search] to an enum

Fixed an inconsistency with 'buddhaEnemy'

'charge_zone' default value 100%, instead of requiring you to give number.
(Seems unnecessary to ask for number)

Added dt style safety checks for 'loadout_set_skill_variant', 'skill', 'skin'
Devs got a command like this, good for like crafting testing
'remove_all_drones` -> `remove_all_minions`
'give_drone' -> Replaced with `spawn_minion`

Maybe more agreeable overlap?
And built upon already better code instead of more so duplicate.

I just like being able to get the minion I want with 1 argument not 4 but that might not be too important.
But other proposed commands are of similiar stature.

Replaces elite with droneTier and axes the TeamIndex argument.
If any other minion specific stuff might get added it could also just get added to this command yknow.
`toggle_hud` -> `hide_hud` consistency with hide_model and easier to type for me.

`true_kill all` now actually does that.

Lang for previous 2 commits.
Copy link
Copy Markdown
Collaborator

@SChinchi SChinchi left a comment

Choose a reason for hiding this comment

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

Second round of review. There are still some big sections that I haven't covered because there are widespread changes related to them.

For create_pickup I had been thinking for some time now changing the signature to create_pickup {pickup} [pickup_type: Permanent]. It immensely simplifies things as there are no more search options, etc. However, it does mean it backwards breaking API change, so I need to run it with the rest of the team. With the release of AC the usefulness of using the pickup catalog has increased further, which is why I am reconsidering this change. This also means I can finally implement set_pickup {pickup} which rerolls the pickup for the pinged/nearest ShopTerminalBehavior/DroneVendorTerminalBehavior/whatever. Depending on what decision is taken, it might be simpler to just revert any changes you've made to create_pickup so I can do my thing.

The other is reverting any changes/macros related to loadout_skill/loadout_skin commands. We shouldn't modify how vanilla code behaves, even if it's just for our added convenience. Unlocking cheat commands is one thing, but changing how the arguments to a command work is another. Furthermore, what I had been thinking about for some time now is reimplementing loadout_set_skill_variant (and the skin one) in our own custom way, because the vanilla one lacks some features. The command executes on server, but only updates the profile data locally, which means clients don't get full use out of it. And if I get to write them my own way, I can reorder the arguments as {slot} {skill} [body] which would easily allow the body to use the self as default. Along with supporting pinged for monsters (mainly for player AI but still) and some other things.

Comment on lines 71 to +77
parser.RegisterStaticVariable("0", "0");
parser.RegisterStaticVariable("1", "1");
parser.RegisterStaticVariable("count", "count");
parser.RegisterStaticVariable("droneTier", "droneTier");
parser.RegisterStaticVariable("duration", "duration");
parser.RegisterStaticVariable("skill_slot", "skill_slot");
parser.RegisterStaticVariable("skill_variant", "skill_variant");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The reason why 0 and 1 have been added as static variables is so that in the command args we can do {some_bool (0|1)} instead of {some_bool ('0'|'1')}. They're basically there for convenience. When you add "count" there, in give_item {item} [count] the count will appear as an actual autocomplete option when typing the second argument, which we don't want.

parser.RegisterStaticVariable("buff", BuffCatalog.buffDefs.Select(i => $"{(int)i.buffIndex}|{StringFinder.GetLangInvar(i.name)}"), 1);
parser.RegisterStaticVariable("tier", ItemTierCatalog.allItemTierDefs.OrderBy(i => i.tier).Select(i => $"{(int)i.tier}|{i.name}"), 1);
parser.RegisterStaticVariable("droptable", ItemTierCatalog.allItemTierDefs.OrderBy(i => i.tier).Select(i => $"{(int)i.tier}|{i.name}"), 1);
parser.RegisterStaticVariable("itemTier", ItemTierCatalog.allItemTierDefs.OrderBy(i => i.tier).Select(i => $"{(int)i.tier}|{i.name}"), 1);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we rename this to itemtier? Mainly because we have already established with list_itemtier the expectation of what that should be called. But also for the consistency of snake case. It would be nice we if could also rename droneTier to either drone_tier or dronetier. Whichever you prefer, though the former looks better to me.

Comment on lines -93 to +94
Log.MessageNetworked(String.Format(Lang.NEGATIVE_ARG, "count"), args, LogLevel.MessageClientOnly);
args.userArgs[1] = (-iCount).ToString();
CCRemoveBuff(args);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

give_buff is technically not syntactically the opposite of remove_buff, which is why negative stacks were not supported from the beginning. give_buff buff 1 4 intends to add one stack for 4 seconds. -1 stacks here wouldn't make sense. In fact, remove_buff for timed stacks always removes the oldest timed stack.

body.AddTimedBuff(buff, duration);
}
Log.MessageNetworked($"Gave {iCount} {name} to {target.name} for {duration} seconds", args);
Log.MessageNetworked($"Gave {iCount} {name} to {target.name} for <color=#53E9FF>{duration} seconds</color>", args);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should avoid colors in logs as much as possible. The main reason I've used green/red for enabled/disabled is because for toggle commands it's very easy to not notice if you're toggling it to the wrong value.

Comment on lines -178 to +180
Log.MessageNetworked(String.Format(Lang.NEGATIVE_ARG, "count"), args, LogLevel.MessageClientOnly);
args.userArgs[1] = (-iCount).ToString();
CCGiveBuff(args);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same argument as above. Negative stacks for remove_buff is not synonymous with positive stacks of give_buff. remove_buff's 3rd argument is supposed to be a bool for whether the buff type is timed or not. give_buff on the other hand expects an explicit integer for the duration of the timed buff. And yes, I'm aware that you can technically pass any non-zero value for bool and it'll count as true, but we'll getting into some implicit conversions here that are not as straightforward as just give_item -> remove_item for negative stacks.

{
powerPedestal.SetComplete(true);
}
Debug.Log("Autocompleting Sentry Terminals");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Change this to the Log class every where in this command.

Comment on lines +213 to +230
if (TeleporterInteraction.instance)
{
destination = "Teleporter";
newPosition = TeleporterInteraction.instance.transform.position;
newPosition += new Vector3(0, 1, 0);
}
else if (BossGroup.GetTotalBossCount() > 0)
{
for (int i = 0; i < CharacterBody.instancesList.Count; i++)
{
if (CharacterBody.instancesList[i].isBoss)
{
newPosition = CharacterBody.instancesList[i].corePosition;
destination = CharacterBody.instancesList[i].name;
break;
}
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm happy to support the final boss explicit locations, but this one not so much. Wouldn't BossGroup.GetTotalBossCount also count things like umbras and AWU?

destination = "Voidling Arena";
newPosition = new Vector3(-105f, 0.2f, 92f);
}
if (stage == "conduitcanyon")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This one has a very different result from all the other ones, I don't think it belongs here.

DebugToolkit.InvokeCMD(args.sender, "kill_all", ((int)TeamIndex.Void).ToString());
return;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be better to modify the team argument to [team (team|'enemies'): Monster] and do something like

TeamIndex[] targetTeams = new[] { TeamIndex.Monster };
if (arg.Count > 0 || args[0] != Lang.DEFAULT_VALUE)
{
    if (arg == 'enemies')
    {
        targetTeams = allNotPlayerTeams;
    }
    else if (TryParse(arg, out team))
    {
        targetTeams = new[] { team };
    }
    else
    {
        Log("Team not found");
        return;
    }
}

foreach (var teamIndex in targetTeams)
{
    DoTheThing();
}

The log can then just be "killed X of team Y" or "killed X total enemies". Lang.KILLALL_HELP could also do with an edit here to explain that enemies refers to all non-player teams.

}
Debug.Log("Autocompleting Sentry Terminals");
}
if (newPosition == Vector3.zero)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would be nice to also include solusweb here.

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.

2 participants