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

sentSpawn functionality #3086

Merged
merged 10 commits into from
Jun 27, 2024
Merged

sentSpawn functionality #3086

merged 10 commits into from
Jun 27, 2024

Conversation

deltamolfar
Copy link
Contributor

@deltamolfar deltamolfar commented Jun 14, 2024

(Re-PR because I accidentally deleted previous fork)
Added :GetBool(), and review changes.

  • Finally a way for E2 to spawn sents.
  • For QoL, limited to wire/native gmod sents + entity tab entities, if wire_expression2_propcore_whitelist <= 0)
  • Thirdparty addons support (ability to add/remove ents to be able to be spawned within whitelist + a hook with same logic as Expression2_CanEffect
  • Entity registration is straightforward, and the sentSpawn does all the E2 to Lua castings itself (No need to put every check in _preFactory'ies).
  • Ability to spawn ALL wire entities (if I didn't forget any).
  • Few helper functions to sentSpawn.

While most of registration code/logic is from starfall prop_sent.lua, I've found and fixed ~10 sents + added ~6 that weren't originally there.

Current minor bugs:

  • gmod_wire_dynamic_button doesn't spawn correctly (commented out).
  • gmod_cameraprop and gmod_emitter spawn with no issue, but don't work as expected (commented out).
  • Undo for some reason doesn't return E2 sent (classname), but e2_spawned_sent when user cancels sent.

Moved casting and typeIdToString to E2Lib and WireLib.

Fixed major bug, where registered sents didn't check for prop protection, when creating constrains.

Changed comments a bit
@deltamolfar deltamolfar requested a review from thegrb93 June 15, 2024 14:30
@thegrb93
Copy link
Contributor

Looks fine, might do a diff against starfall's to sanity check.

Copy link
Contributor

@thegrb93 thegrb93 left a comment

Choose a reason for hiding this comment

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

I think sents_default_params.lua needs to be put somewhere outside of lua/entities. putting lua files there registers the filename as an entity class.

@thegrb93
Copy link
Contributor

Diffed the changes and they mostly look ok. The gmod_wire_value code is pretty messy, but whatever.

deltamolfar and others added 4 commits June 23, 2024 16:05
Moved sents_default_params.lua
Renamed sents_default_params.lua
Changed the way to block sents, and renamed whitelist to registry, to reinforce reusability for thirdparty addons
@deltamolfar
Copy link
Contributor Author

deltamolfar commented Jun 23, 2024

  • Alright, I've moved it and renamed sents_default_params.lua out of entities folder, to lua/wire/server/sents_registry.lua.
  • Changed a whitelist/registry logic a bit (reinforced the registry reusability by thirdparty addons, by separating registering wire elements, and blacklisting).
  • Few QoL fixes.

Regarding gmod_wire_value code is messy because I didn't like how it was implemented in sf, so I've decided to expand the value setting logic, while leaving support for the sf way. Code is messy, but I'm not sure how to make it cleaner without separating logic into few, never reused functions out of gmod_wire_value's preFactory. I think it's fine to leave it as is for now, as it will not really harm any future work, and maybe someday someone, or me, will refactor that.

@deltamolfar deltamolfar requested a review from thegrb93 June 23, 2024 17:50
@thegrb93 thegrb93 merged commit e587aec into wiremod:master Jun 27, 2024
1 check passed
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