Code Monkey home page Code Monkey logo

Comments (6)

mkahvi avatar mkahvi commented on June 23, 2024 1

Add third parameter to the call that holds a return value object:

const result = { distance: 0 };
Hooks.call('ReplaceArmsReachInteraction', doorData, result);
// and then do something with `result.distance`

And then you'd hook into it something like:

Hooks.on('ReplaceArmsReachInteraction', (doorData, result) => result.distance = 5);

from foundryvtt-arms-reach.

p4535992 avatar p4535992 commented on June 23, 2024

Hi, ty for the feedback.
Forgive me I don't know anything about Pathfinder, could you try to better describe which feature you would like to be integrated?

Would you like to have the possibility to set the distance instead of in grid of squares in units of measure such as "ft" or "mt"?

I always try to make this module as independent as possible from the system used, and eventually I add additional settings to manage the use cases of the various game systems.

from foundryvtt-arms-reach.

mkahvi avatar mkahvi commented on June 23, 2024

More of an ability to override the distance calculation, with a hook or something.

But if you want to implement it directly: It's essentially using actor.data.data.range.melee for checking the appropriate distance at which to allow opening things, preferably with minimum distance of 1 grid cell (Math.max(5, actor.data.data.range.melee) pretty much). That variable stores its distance in feet as is normal for the system.

It doesn't need to be exact distance, but simply using that variable for determining it.

Tho I still think it's better to just provide a hook for it that a module or even the game system could fill independently (so any system could have their custom thing fairly trivially), since this would probably not work for people who use the alternative metric system.

But speaking of it, option of ignoring cell distance would be nice for people who play gridless regardless of system (which is also a by rules option for PF1).

Sorry if this doesn't clear it up sufficiently.

from foundryvtt-arms-reach.

p4535992 avatar p4535992 commented on June 23, 2024

Hei mkahvl, i'm trying to integrate a hook for "replace" my standard calculation distance, but i encounter some issue on the developing..... here the code i have in mind:

const resultExplicitComputeDistance = Hooks.call('ReplaceArmsReachInteraction', doorData);
          // undefined|null|Nan go with the standard compute distance
          if(resultExplicitComputeDistance && typeof(resultExplicitComputeDistance) == 'number'){
            // 0 : Custom compute distance fail
            if (<number>resultExplicitComputeDistance === 0) {
              isNotNearEnough = false;
            }
            // 1 : Custom compute success
            else if (<number>resultExplicitComputeDistance === 1) {
              isNotNearEnough = true;
            }
            // 2 : If Custom compute distance fail fallback to the standard compute distance
            else if (<number>resultExplicitComputeDistance === 2) {
              // Conntinue
            }
            // x < 0 || x > 2 just fail
            else{
              isNotNearEnough = false;
            }
          }

but with the Hooks.call i retireve only a boolean did you know if there is a way to return a number like in this case ?

from foundryvtt-arms-reach.

p4535992 avatar p4535992 commented on June 23, 2024

Add some hook for try to solve this issue

from foundryvtt-arms-reach.

p4535992 avatar p4535992 commented on June 23, 2024

This issue is solved with version 2.0.0 . Now you can customize the module drag-ruler , here the details on the api and the calculation distance is the same i used for door and stairways.
P.S. you can finally add the range arm based on the value on the single actor/token

from foundryvtt-arms-reach.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.