Skip to content

Feat: Add Card:can_sell() API method#1254

Open
NeatsTopFoo wants to merge 6 commits intoSteamodded:mainfrom
NeatsTopFoo:main
Open

Feat: Add Card:can_sell() API method#1254
NeatsTopFoo wants to merge 6 commits intoSteamodded:mainfrom
NeatsTopFoo:main

Conversation

@NeatsTopFoo
Copy link
Copy Markdown
Contributor

@NeatsTopFoo NeatsTopFoo commented Mar 11, 2026

Identical to other API method patches - But from what I can see, looks like it needs to be in better_calc.toml? As the area where the API method needs to be directly follows an eternal check and the next thing after that is a return.

May need to be moved to center.toml

Additional Info:

  • I didn't modify api's or I've made a PR to the wiki repo.
  • I didn't modify api's or I've updated lsp definitions.
  • I didn't make new lovely files or all new lovely files have appropriate priority.

Identical to other API method patches - But from what I can see, looks like it needs to be in better_calc.toml? As the area where the API method needs to be directly follows an eternal check and the next thing after that is a return.

May need to be moved to center.toml
NeatsTopFoo and others added 2 commits March 11, 2026 03:10
Ret check changed to a more strict nil check as it was ignoring falsy values
@nh6574
Copy link
Copy Markdown
Member

nh6574 commented Mar 11, 2026

Looks good to me! The only comment is that context in that function is never really used in a vanilla, but I'm sure it doesn't hurt to pass it.
I added lsp definitions for now, I'll leave it open to see if anyone has any comments before merging.

@NeatsTopFoo NeatsTopFoo changed the title Add Card:can_sell() API method Add Card:can_sell() API method Mar 16, 2026
@NeatsTopFoo NeatsTopFoo changed the title Add Card:can_sell() API method Feat: Add Card:can_sell() API method Mar 17, 2026
@nh6574
Copy link
Copy Markdown
Member

nh6574 commented Mar 22, 2026

Ok, taking a second look I spot two issues: First the patch returns two values when can_sell_card only returns one. Second, it might be a bit confusing to make the function need to explicitly return a boolean instead of boolean|nil.

@NeatsTopFoo
Copy link
Copy Markdown
Contributor Author

Ok, taking a second look I spot two issues: First the patch returns two values when can_sell_card only returns one. Second, it might be a bit confusing to make the function need to explicitly return a boolean instead of boolean|nil.

Yes. Although this is just directly lifted from other API implementations, my thought process was that since this would operate based on the developer addition of a function to modded Joker implementations that operate in the same way, with similar expectations, that this could be potentially leveraged with further refinement in case there's some kind of feasible use case for a second return value. I personally can't think of a use case (I did initially think of something potentially involving Eternal, but developers can and should just hook SMODS.is_eternal in that circumstance to achieve their desired effect), but I decided to leave it in, in case someone was able to think of a reason why two return values should be parsed from can_sell

If it does turn out that there isn't a feasible use case, I don't mind removing the second return value and just expecting it to return a boolean, for simplicity.

@nh6574
Copy link
Copy Markdown
Member

nh6574 commented Mar 23, 2026

In that case the second value would be added alongside whatever feature uses it. I don't see a reason for it to be 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