Coder Social home page Coder Social logo

Comments (3)

VojtaStruhar avatar VojtaStruhar commented on September 6, 2024 1

The issue is, that the PandoraReference class isn't considered of type "reference" and fails the is_valid_type check.

func(variant): return variant is PandoraEntity,

Adding PandoraReference to the type check should be fine, I think. I tried it, seemed to work just fine.

func(variant): return variant is PandoraEntity or variant is PandoraReference,

But I don't understand the codebase well enough (yet!) to be fully confident.

from pandora.

bitbrain avatar bitbrain commented on September 6, 2024 1

@VojtaStruhar the idea is that the reference gets created dynamically inside Pandora. From an API perspective, it should always be PandoraEntity.

Let me see today what the issue is here!

from pandora.

VojtaStruhar avatar VojtaStruhar commented on September 6, 2024 1

I dug a little more and found, that after selecting entity from a dropdown, you wrap it in PandoraReference and then call set_default_value with it:

# reference_property.gd, _ready
entity_picker.entity_selected.connect(
  func(entity:PandoraEntity):
    var reference = PandoraReference.new(entity.get_entity_id(), 1 if entity is PandoraCategory else 0)
    _property.set_default_value(reference)
    property_value_changed.emit())

But in set_default_value you have a very similar piece of code that does the same thing conditionally:

if value is PandoraEntity:
  value = PandoraReference.new(value.get_entity_id(), PandoraReference.Type.CATEGORY if value is PandoraCategory else PandoraReference.Type.ENTITY)

I think that in the entity_picker, we are wrapping the entity in a PandoraReference too early! I tried to pass in just the entity, seems to work just fine. I had a look in the stored data too - it seems to add the override correctly:

Copper ore rarity override - effect in stored data

If this sounds good to you, I'll make a pull request, it's a one-liner :)

from pandora.

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.