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

Some random things that i can't think of single name for #342

Merged
merged 37 commits into from
Oct 17, 2023

Conversation

Mr-Auto
Copy link
Contributor

@Mr-Auto Mr-Auto commented Oct 7, 2023

  • add_custom_type
  • get_entities_by_draw_depth
  • kill_recursive
  • destroy_recursive

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented Oct 7, 2023

Tested a little with all kinds of setups. Also the destroy_recursive very nicely gets rid of the bosses (Olmec, Tiamat, Kingu)

@Dregu
Copy link
Collaborator

Dregu commented Oct 7, 2023

Tested a little with all kinds of setups. Also the destroy_recursive very nicely gets rid of the bosses (Olmec, Tiamat, Kingu)

But probably not megajelly... It's weird af and the tail is not attached to anything. ui_util has a funny method to destroy it though, might want to add that here.

@Dregu
Copy link
Collaborator

Dregu commented Oct 7, 2023

UI::safe_destroy also has this philosophy that you can select something really stupid like the bosses left arm, and it will first find the parent and then recursively destroy the parts. That's not really the point of this function, but if we add the api safe_destroy, this is the way.

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented Oct 7, 2023

Tested a little with all kinds of setups. Also the destroy_recursive very nicely gets rid of the bosses (Olmec, Tiamat, Kingu)

But probably not megajelly... It's weird af and the tail is not attached to anything. ui_util has a funny method to destroy it though, might want to add that here.

That one person who coded the CO is crazy, orbs being tracked by uid + (n), same with tail

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented Oct 7, 2023

Also one thing that I'm not sure of:
in INCLUSIVE mode, you have to have the mask or type of the main entity in the parameters to actually kill/destroy it, and similar with EXCLUSIVE if you have the entity type or mask in the parameters it won't kill/destroy it either

But it feels like it should always kill/destroy the main entity, should I change that?

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented Oct 7, 2023

UI::safe_destroy also has this philosophy that you can select something really stupid like the bosses left arm, and it will first find the parent and then recursively destroy the parts. That's not really the point of this function, but if we add the api safe_destroy, this is the way.

I kind of stayed away from the safe_destroy as it's actually super complicated, with some situations that aches your brain with "what if the user actually wants it this way". Thou i always wanted to do safe_spawn, but never actually took the time to do it

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented Oct 7, 2023

Tested a little with all kinds of setups. Also the destroy_recursive very nicely gets rid of the bosses (Olmec, Tiamat, Kingu)

But probably not megajelly... It's weird af and the tail is not attached to anything. ui_util has a funny method to destroy it though, might want to add that here.

So i made the code, but then started thinking, maybe i should write a patch for this instead? then we could have a jellyfish with shorter tail, or even more with some more code

@Dregu
Copy link
Collaborator

Dregu commented Oct 7, 2023

But it feels like it should always kill/destroy the main entity, should I change that?

I can't think of a reason right now, but it does sound useful to be able to only destroy some matching parts but not the main entity.

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented Oct 7, 2023

But it feels like it should always kill/destroy the main entity, should I change that?

I can't think of a reason right now, but it does sound useful to be able to only destroy some matching parts but not the main entity.

that's not what the function will do. If the entity in excluded or not included it will not be killed/destroyed along with the items attached to it.

So for example: if you kill push block with item rock included, it will not kill the rock that the player standing on the pushblock is holding

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented Oct 8, 2023

Could also just expose the get_hud function or even make a global variable like state and players

@Dregu
Copy link
Collaborator

Dregu commented Oct 8, 2023

Could also just expose the get_hud function or even make a global variable like state and players

Exposing the function is fine.

This add_money script should be just part of the api, adding the shop total automatically. The hud function is fine, but nobody really needs to jump through those hoops.

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented Oct 8, 2023

Could also just expose the get_hud function or even make a global variable like state and players

Exposing the function is fine.

This add_money script should be just part of the api, adding the shop total automatically. The hud function is fine, but nobody really needs to jump through those hoops.

I didn't want to decide if it should add money to the inventory.money or state.money_shop_total since someone can use both for something, making separate counters for each player on how much money they collected for example. So they want the money to actually be added to the specific player inventory and not the money_shop

@Dregu
Copy link
Collaborator

Dregu commented Oct 8, 2023

So they want the money to actually be added to the specific player inventory and not the money_shop

Ok, how about add_money(amount) goes to the total and add_money(amount, playerid) goes to the inventory.

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented Oct 8, 2023

So they want the money to actually be added to the specific player inventory and not the money_shop

Ok, how about add_money(amount) goes to the total and add_money(amount, playerid) goes to the inventory.

playerslot instead of playerid?

@Dregu
Copy link
Collaborator

Dregu commented Oct 8, 2023

playerslot instead of playerid?

Yeah that, I don't even know what playerid is.

@Dregu
Copy link
Collaborator

Dregu commented Oct 8, 2023

So at least doors don't crash, but we still need

set_post_entity_spawn(function(e)
  e:set_pre_on_collision2(function(_, d)
    return not test_flag(d.flags, ENT_FLAG.ENABLE_BUTTON_PROMPT)
  end)
end, SPAWN_TYPE.ANY, MASK.ANY, ENT_TYPE.PET)

to make the dogs act normally, i.e. just keep walking past closed doors.

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented Oct 8, 2023

So at least doors don't crash, but we still need
...
to make the dogs act normally, i.e. just keep walking past closed doors.

Probably easier this way than to just patch another game code

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented Oct 14, 2023

+1k, think I'm not with this PR

@Dregu
Copy link
Collaborator

Dregu commented Oct 14, 2023

I've been trying to keep up with it, but I think I'll need to read some of those lines again tomorrow...

docs/game_data/spel2.lua Outdated Show resolved Hide resolved
@Dregu Dregu merged commit 7080921 into spelunky-fyi:main Oct 17, 2023
9 checks passed
@Mr-Auto Mr-Auto deleted the stuff branch October 20, 2023 18:57
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