[Feature]: Adjust getLights() function so that it returns light Types Instead of just Light Names

Open
#6,046 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
java
Domain
game-dev

Research direction

Find the MapTool macro implementation of getLights and how it handles the "*" argument. Compare that with campaign light-source data already reachable via getInfo("campaign") and json.fields as described in the issue. Change the return so each light includes type as well as name, then check on a token with several lights. Do not invent file paths the issue does not name.

Written by the indexing model from the issue text.

Description

feature
Describe the Problem

It's frustrating when you want to store active token lights as a property, but can't get the information you need from the command designed to return a Token's light information: getLights("*").

The Solution you'd like

I would like to see the getLights("*") function return both the light Type and light Name if * is used as an argument, since you're asking for all lights to be returned. This would facilitate a robust way of storing light data for recall later.

Alternatives that you've considered.

There are workarounds that can be done by building a light listing/library, something like:

[h: camp = getInfo("campaign")]
[h: ls = json.get(camp, "light sources")]
[h: types = json.fields(ls)]

Then use that table to reverse-lookup matching lights sources.

Also, @Baaaaaz provided some script that is functional for this, but it's definitely a work-around for something that feels should be intuitively included.

Additional Context

No response

Dominant language
Java
Stars
927
Forks
286
Avg merge
3d 17h
Merged PRs (30d)
94

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RPTools/maptool

All issues in RPTools/maptool

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.