Skip to content

Commit

Permalink
Add a vector_length configuration setting that specifies the default …
Browse files Browse the repository at this point in the history
…minimum

length of a vector for it to be visible.  Configuring that value is a persistent
way of doing "/w vector length <number>" - it also sets the current vector length.

Fixed /w config's handling of some settings so that when a new value is not
specified, the setting is either toggled (if boolean) or the current value shown.

Fixed saving of time_ordered_deposits in the configuration file (typo in the
previous commit).
  • Loading branch information
totemo committed Aug 11, 2015
1 parent c71cfb6 commit 37d06e9
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 46 deletions.
6 changes: 5 additions & 1 deletion Changes.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
Change History
==============
0.10.1.117-mc1.8.0
0.10.1.118-mc1.8.0
-----------------
* For LogBlock, the following date formats are now supported: yyyy-MM-dd (ISO 8601), yy-MM-dd, MM-dd (the LogBlock default).
* If reformatting of parsed results is enabled, kills are formatted as "killer weapon > victim".
* Added a time_ordered_deposits (on/off) configuration setting to number deposits strictly by timestamp, rather than considering rarity of the ore.
* Added a vector_length configuration setting that is the default minimum length for a vector to be visible.
* Fix ore deposit label billboards having a solid background colour; they can now be transparent again.
* /w config now shows colours in hexadecimal #AARRGGBB format.

0.10.0.115-mc1.8.0
-----------------
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ Given the above commands for working with ore deposits, a basic x-ray checking p

### Manipulating the Vector and Outline Displays

Watson draws vectors (arrows) from each edit to the next edit which is more recent, provided that the distance in space between the edits is greater than the minimum vector length. The default minimum length is 4. To draw vectors between all edits:
Watson draws vectors (arrows) from each edit to the next edit which is more recent, provided that the distance in space between the edits is greater than the minimum vector length. The default minimum length is a configuration setting that defaults to 4.0. To draw vectors between all edits:

/w vector length 1
/w vector length 0

The above command sets the minimum vector length for the current session. The minimum vector length can be permanently changed to that value using:

/w config vector_length 0

To hide, show or toggle the vector display:

Expand Down Expand Up @@ -467,6 +471,9 @@ Running "/w config help" will show help for all of the configuration settings.
<tr>
<td>time_ordered_deposits</td> <td>on / off</td> <td>off</td> <td>When off (the default) ore deposits are numbered in order of their significance to investigating xray (diamonds before iron, before coal). When on, ore deposits are numbered in the order they were mined.</td> <td>/w config time_ordered_deposits on</td>
</tr>
<tr>
<td>vector_length</td> <td>decimal</td> <td>4.0</td> <td>Specifies the minimum length (in blocks) of a vector for it to be visible.</td> <td>/w config vector_length 0</td>
</tr>
</table>


Expand Down
4 changes: 2 additions & 2 deletions build/buildnumber.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Sat Jun 20 10:23:32 ACST 2015
build.number=116
#Tue Aug 11 17:57:57 ACST 2015
build.number=119
4 changes: 2 additions & 2 deletions res/litemod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

"name": "watson",
"mcversion": "1.8.0",
"version": "0.10.0.115-mc1.8.0",
"revision": "115",
"version": "0.10.0.118-mc1.8.0",
"revision": "118",
"author": "totemo",
"description": "A 3-D log visualisation tool."
}
37 changes: 36 additions & 1 deletion src/watson/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public void message(String text)
_reformatQueryResults = (Boolean) dom.get("reformat_query_results");
_recolourQueryResults = (Boolean) dom.get("recolour_query_results");
_timeOrderedDeposits = (Boolean) dom.get("time_ordered_deposits");
_vectorLength = ((Double) dom.get("vector_length")).floatValue();
}
catch (Exception ex)
{
Expand Down Expand Up @@ -124,7 +125,8 @@ public void save()
dom.put("ss_date_directory", _ssDateDirectory.toPattern());
dom.put("reformat_query_results", _reformatQueryResults);
dom.put("recolour_query_results", _recolourQueryResults);
dom.put("time_ordered_desposits", _timeOrderedDeposits);
dom.put("time_ordered_deposits", _timeOrderedDeposits);
dom.put("vector_length", (double) _vectorLength);

DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
Expand Down Expand Up @@ -745,6 +747,34 @@ public boolean timeOrderedDeposits()
return _timeOrderedDeposits;
}

// --------------------------------------------------------------------------
/**
* Set the default minimum length of vectors for them to be visible.
*
* The current displayed minimum vector length is also set.
*
* @param length the minimum length of a vector for it to be visible.
*/
public void setVectorLength(float length)
{
_vectorLength = length;
Controller.instance.getDisplaySettings().setMinVectorLength(length);
save();
}

// --------------------------------------------------------------------------
/**
* Set the default minimum length of vectors for them to be visible.
*
* The current displayed minimum vector length is also set.
*
* @param length the minimum length of a vector for it to be visible.
*/
public float getVectorLength()
{
return _vectorLength;
}

// --------------------------------------------------------------------------
/**
* Perform lazy initialisation of the SnakeValidator used to validate in
Expand Down Expand Up @@ -780,6 +810,7 @@ protected void configureValidator()
root.addChild("reformat_query_results", new TypeValidatorNode(Boolean.class, true, true));
root.addChild("recolour_query_results", new TypeValidatorNode(Boolean.class, true, true));
root.addChild("time_ordered_deposits", new TypeValidatorNode(Boolean.class, true, false));
root.addChild("vector_length", new TypeValidatorNode(Double.class, true, 4.0));

_validator.setRoot(root);
}
Expand Down Expand Up @@ -914,5 +945,9 @@ protected void configureValidator()
*/
protected boolean _timeOrderedDeposits = false;

/**
* The default minimum length of vectors for them to be visible.
*/
protected float _vectorLength = 4.0f;
} // class Configuration

43 changes: 22 additions & 21 deletions src/watson/DisplaySettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import net.minecraft.world.WorldSettings;
import watson.chat.Chat;

// --------------------------------------------------------------------------
// ----------------------------------------------------------------------------
/**
* Records the current settings that affect the Watson displays.
*/
Expand All @@ -20,12 +20,13 @@ public void configure(String serverIP, WorldSettings.GameType gameType)
// presence of ModMode and its associated notifications to turn on or off
// the display.
_displayed = gameType.isCreative();
_minVectorLength = Configuration.instance.getVectorLength();
}

// --------------------------------------------------------------------------
/**
* Turn on or off all Watson displays.
*
*
* @param displayed true if Watson draws stuff; false otherwise.
*/
public void setDisplayed(boolean displayed)
Expand All @@ -38,7 +39,7 @@ public void setDisplayed(boolean displayed)
// --------------------------------------------------------------------------
/**
* Return true if Watson draws stuff; false otherwise.
*
*
* @return true if Watson draws stuff; false otherwise.
*/
public boolean isDisplayed()
Expand All @@ -50,10 +51,10 @@ public boolean isDisplayed()
/**
* Return true if the Watson display's visibility setting has changed since
* the last time this method was called.
*
*
* This is used by the Watson Macro/Keybind Support mod to determine when to
* dispatch the corresponding event.
*
*
* @return true if isDisplayed() has changed.
*/
public boolean isDisplayVisibilityChanged()
Expand All @@ -66,7 +67,7 @@ public boolean isDisplayVisibilityChanged()
// --------------------------------------------------------------------------
/**
* Turn on or off the wireframe block outline display.
*
*
* @param outlineShown if true, block outlines are drawn.
*/
public void setOutlineShown(boolean outlineShown)
Expand All @@ -78,11 +79,11 @@ public void setOutlineShown(boolean outlineShown)
// --------------------------------------------------------------------------
/**
* Return true if block outines should be drawn.
*
*
* This method takes into account the last calls to both setOutlineShown() and
* setDisplayed(). It will return false if outlines are disabled or if the
* overall Watson display is turned off.
*
*
* @return true if block outines should be drawn.
*/
public boolean isOutlineShown()
Expand All @@ -93,7 +94,7 @@ public boolean isOutlineShown()
// --------------------------------------------------------------------------
/**
* Turn on or off the annotation display.
*
*
* @param annotationsShown if true, annotations are drawn.
*/
public void setAnnotationsShown(boolean annotationsShown)
Expand All @@ -106,7 +107,7 @@ public void setAnnotationsShown(boolean annotationsShown)
// --------------------------------------------------------------------------
/**
* Return true if block annotations should be drawn.
*
*
* @return true if block annotations should be drawn.
*/
public boolean areAnnotationsShown()
Expand All @@ -117,7 +118,7 @@ public boolean areAnnotationsShown()
// --------------------------------------------------------------------------
/**
* Turn on or off the ore deposit number labels.
*
*
* @param labelsShown if true, labels are shown.
*/
public void setLabelsShown(boolean labelsShown)
Expand All @@ -129,7 +130,7 @@ public void setLabelsShown(boolean labelsShown)
// --------------------------------------------------------------------------
/**
* Return true if ore deposit labels should be drawn.
*
*
* @return true if ore deposit labels should be drawn.
*/
public boolean areLabelsShown()
Expand All @@ -140,7 +141,7 @@ public boolean areLabelsShown()
// --------------------------------------------------------------------------
/**
* Turn on or off the wireframe vector display.
*
*
* @param outlineShown if true, vectors between sufficiently spaced blocks are
* drawn.
*/
Expand All @@ -153,11 +154,11 @@ public void setVectorsShown(boolean vectorsShown)
// --------------------------------------------------------------------------
/**
* Return true if block outines should be drawn.
*
*
* This method takes into account the last calls to both setOutlineShown() and
* setDisplayed(). It will return false if outlines are disabled or if the
* overall Watson display is turned off.
*
*
* @return true if block outines should be drawn.
*/
public boolean areVectorsShown()
Expand All @@ -169,7 +170,7 @@ public boolean areVectorsShown()
/**
* Control whether block creations are linked by vectors (when they are
* shown).
*
*
* @param linkedCreations if true, links are drawn.
*/
public void setLinkedCreations(boolean linkedCreations)
Expand All @@ -182,7 +183,7 @@ public void setLinkedCreations(boolean linkedCreations)
// --------------------------------------------------------------------------
/**
* Return true if vectors are drawn between block creations.
*
*
* @return true if vectors are drawn between block creations.
*/
public boolean isLinkedCreations()
Expand All @@ -194,7 +195,7 @@ public boolean isLinkedCreations()
/**
* Control whether block destructions are linked by vectors (when they are
* shown).
*
*
* @param linkedDestructions if true, links are drawn.
*/
public void setLinkedDestructions(boolean linkedDestructions)
Expand All @@ -207,7 +208,7 @@ public void setLinkedDestructions(boolean linkedDestructions)
// --------------------------------------------------------------------------
/**
* Return true if vectors are drawn between block destructions.
*
*
* @return true if vectors are drawn between block destructions.
*/
public boolean isLinkedDestructions()
Expand All @@ -218,7 +219,7 @@ public boolean isLinkedDestructions()
// --------------------------------------------------------------------------
/**
* Set the minimum length of a vector between edits for it to be drawn.
*
*
* @param minVectorLength
*/
public void setMinVectorLength(float minVectorLength)
Expand All @@ -231,7 +232,7 @@ public void setMinVectorLength(float minVectorLength)
// --------------------------------------------------------------------------
/**
* Return the minimum length of a vector between edits for it to be drawn.
*
*
* @return the minimum length of a vector between edits for it to be drawn.
*/
public float getMinVectorLength()
Expand Down
Loading

0 comments on commit 37d06e9

Please sign in to comment.