Minetest-WorldEditAdditions icon indicating copy to clipboard operation
Minetest-WorldEditAdditions copied to clipboard

WEA Tool self containment

Open VorTechnix opened this issue 1 year ago • 8 comments

Problems:

  • Move over to wea_c.pos completely -- Some tools (specifically Cloudwand) still use wea.selection
  • Multiwand still uses wea.farwand.do_raycast -- needs to be moved over to wea_t.do_raycast like the Cloudwand uses https://github.com/sbrl/Minetest-WorldEditAdditions/blob/d638a349a9070a0ada035ef6a655dfc7e260e78c/worldeditadditions_tools/items/multiwand.lua#L47
  • Minimize the number of files that need local wea = worldeditadditions and if possible remove dependency on WEA altogether so that WEA Tool only needs WEA Core as a dependency
  • I will do work after PR #117 is completed to remove the WE dependency which is mostly just calls to WE.player_notify which I already have plans to replace #116

VorTechnix avatar Oct 10 '24 15:10 VorTechnix

Erm I don't see wea_t depending on main wea as a problem - in fact I have an idea in my head to implement an advanced tool that can temporarily take over your hotbar that will depend on wea

Similarly the raycasting function really should live in worldeditadditions_core and not the far wands mod I think, as it could be useful to other functions

but the rest looks good! thanks for doing this, 'cause it's really needed

sbrl avatar Oct 10 '24 22:10 sbrl

Oh wait, I see why we have do_raycast in wea_t

ignore me on that point

sbrl avatar Oct 10 '24 22:10 sbrl

Erm I don't see wea_t depending on main wea as a problem - in fact I have an idea in my head to implement an advanced tool that can temporarily take over your hotbar that will depend on wea

Oh, ok. I just found that very few things actually were depending on WEA so I figured we could eliminate those but if you're planning to expand that's fine.

Similarly the raycasting function really should live in worldeditadditions_core and not the far wands mod I think, as it could be useful to other functions

Right now we have 3 raycast functions: wea.farwand.do_raycast, wea_core.do_raycast and wea_tool.do_raycast which is a wrapper for wea_core.do_raycast. At least one of those needs to go!

VorTechnix avatar Oct 10 '24 22:10 VorTechnix

Right That is a problem Okay

In your branch farwand-refactor I see:

....but I don't see wea.farwand.do_raycast?

sbrl avatar Oct 10 '24 22:10 sbrl

https://github.com/sbrl/Minetest-WorldEditAdditions/blob/e89d61034fcbf8f2ce9479efc6101155f13cee18/worldeditadditions_farwand/lib/multiwand.lua#L46

VorTechnix avatar Oct 10 '24 22:10 VorTechnix

I still can't find that function definition wow

How does it even still work?

sbrl avatar Oct 10 '24 23:10 sbrl

Got it

On dev: https://github.com/sbrl/Minetest-WorldEditAdditions/blob/30e154944d2ac9282d2960ff711ea39baf57f641/worldeditadditions_farwand/init.lua#L1

note that originally the main namespace is registered under worldeditadditions as wea.farwand

Hence the wea.farwand.do_raycast call in your branch needs to read wea_t.raycast

sbrl avatar Oct 10 '24 23:10 sbrl

Pushed a commit to tidy this whole situation w/compat pos.lua calls up

b57b3e85ee42c10b191cdb46d3c16dfb4c3ca89f..90f97234a881de012fcadb69492dba985f873d16

sbrl avatar Oct 10 '24 23:10 sbrl