Skip to content

Commit

Permalink
Merge pull request #110 from EDCD/VerticalBlank-fix-107
Browse files Browse the repository at this point in the history
Fix issue where EDDI describes all bodies as unsuitable for landing if you scan them without a DSS.
  • Loading branch information
richardbuckle authored Sep 27, 2017
2 parents bc07b8c + 294c732 commit 8176f7d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions EDDI/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* 'Community goal' event - fixed a bug that was causing EDDI to describe every goal twice
* 'Ship transfer initiated' event - revised to include both the transfer cost and the time to arrival
* Script changes
* If you scan without a DSS, the 'Body Report' script no longer falsely claims that all bodies are unsuitable for landing
* 'Module swapped event' - revised script to better handle swapping to an empty slot

### 2.4.0-b3
Expand Down
15 changes: 8 additions & 7 deletions JournalMonitor/JournalMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2739,13 +2739,14 @@ private static bool getBool(string key, object val)
private static bool? getOptionalBool(IDictionary<string, object> data, string key)
{
object val;
data.TryGetValue(key, out val);
return getOptionalBool(key, val);
}

private static bool? getOptionalBool(string key, object val)
{
return (bool?)val;
if (data.TryGetValue(key, out val))
{
return val as bool?;
}
else
{
return null;
}
}

private static string getString(IDictionary<string, object> data, string key)
Expand Down
4 changes: 2 additions & 2 deletions SpeechResponder/eddi.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"enabled": true,
"priority": 3,
"responder": false,
"script": "{_ Fetch from context }\r\n{set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}\r\n{if !reportbody.name || reportbody.name = \"\": {set reportbody to BodyDetails(state.eddi_context_body_name)} }\r\n\r\n{if !reportbody.name || reportbody.name = \"\":\r\n I'm not sure which body you are asking about.\r\n\r\n|elif state.eddi_context_nav_scans && state.eddi_context_nav_scans > 0:\r\n {_ Do nothing if this scan is part of a nav beacon scan _}\r\n\r\n|else:\r\n {P(reportbody.name)} is a\r\n {if reportbody.gravity < 0.5:\r\n low-gravity\r\n |elif reportbody.gravity <2:\r\n medium-gravity\r\n |elif reportbody.gravity <4:\r\n high-gravity\r\n |else:\r\n extremely high-gravity\r\n }\r\n\r\n {if reportbody.tidallylocked:\r\n tidally-locked\r\n }\r\n\r\n {if reportbody.terraformstate = \"Terraformable\":\r\n terraformable\r\n |elif reportbody.terraformstate = \"Terraformed\":\r\n terraformed\r\n }\r\n\r\n {if len(reportbody.rings) > 0:\r\n ringed\r\n }\r\n\r\n\r\n {reportbody.planettype}\r\n\r\n {if reportbody.terraformstate = \"Terraforming\":\r\n in the process of being terraformed\r\n }\r\n\r\n that is\r\n\r\n {if reportbody.landable:\r\n suitable\r\n |else:\r\n unsuitable\r\n }\r\n for landing.\r\n\r\n {_ Atmosphere? }\r\n\r\n {if reportbody.volcanism:\r\n This planet shows signs of volcanism, with\r\n {if reportbody.volcanism.type = 'Geysers':\r\n {if reportbody.volcanism.amount = 'Major':\r\n high numbers of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low numbers of\r\n }\r\n active {reportbody.volcanism.composition} geysers\r\n |else:\r\n {if reportbody.volcanism.amount = 'Major':\r\n high levels of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low levels of\r\n }\r\n active {reportbody.volcanism.composition} magma flows\r\n }.\r\n }\r\n\r\n {if reportbody.landable :\r\n It has a\r\n {if reportbody.rotationalperiod < -20.0:\r\n slow retrograde\r\n |elif reportbody.rotationalperiod < -0.5:\r\n retrograde\r\n |elif reportbody.rotationalperiod < 0:\r\n fast retrograde\r\n |elif reportbody.rotationalperiod <= 0.5:\r\n fast\r\n |elif reportbody.rotationalperiod > 20.0:\r\n slow\r\n }\r\n rotational period of {Humanise(reportbody.rotationalperiod)}\r\n day{if Humanise(reportbody.rotationalperiod) != \"1\":s}.\r\n\r\n {set goodmaterials to []}\r\n {set greatmaterials to []}\r\n {for material in reportbody.materials:\r\n {if material.percentage >= MaterialDetails(material.material).greatpctbody:\r\n {set greatmaterials to cat(greatmaterials, [material])}\r\n |elif material.percentage >= MaterialDetails(material.material).goodpctbody:\r\n {set goodmaterials to cat(goodmaterials, [material])}\r\n }\r\n }\r\n\r\n {if len(greatmaterials) > 0:\r\n This body contains very high levels of\r\n {if len(greatmaterials) = 1:\r\n {greatmaterials[0].material}\r\n |elif len(greatmaterials) = 2:\r\n {greatmaterials[0].material} and {greatmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(greatmaterials):\r\n {if cur = 0:\r\n {greatmaterials[cur].material}\r\n |elif cur < len(greatmaterials) - 1:\r\n , {greatmaterials[cur].material}\r\n |else:\r\n , and {greatmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(goodmaterials) > 0:\r\n {if len(greatmaterials) > 0:\r\n and high levels of\r\n |else:\r\n This body contains high levels of\r\n }\r\n {if len(goodmaterials) = 1:\r\n {goodmaterials[0].material}\r\n |elif len(goodmaterials) = 2:\r\n {goodmaterials[0].material} and {goodmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(goodmaterials):\r\n {if cur = 0:\r\n {goodmaterials[cur].material}\r\n |elif cur < len(goodmaterials) - 1:\r\n , {goodmaterials[cur].material}\r\n |else:\r\n , and {goodmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(greatmaterials) > 0 || len(goodmaterials) > 0:\r\n .\r\n }\r\n }\r\n}",
"script": "{_ Fetch from context }\r\n{set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}\r\n{if !reportbody.name || reportbody.name = \"\": {set reportbody to BodyDetails(state.eddi_context_body_name)} }\r\n\r\n{if !reportbody.name || reportbody.name = \"\":\r\n I'm not sure which body you are asking about.\r\n|else:\r\n {P(reportbody.name)} is a\r\n {if reportbody.gravity < 0.5:\r\n low-gravity\r\n |elif reportbody.gravity <2:\r\n medium-gravity\r\n |elif reportbody.gravity <4:\r\n high-gravity\r\n |else:\r\n extremely high-gravity\r\n }\r\n\r\n {if reportbody.tidallylocked:\r\n tidally-locked\r\n }\r\n\r\n {if reportbody.terraformstate = \"Terraformable\":\r\n terraformable\r\n |elif reportbody.terraformstate = \"Terraformed\":\r\n terraformed\r\n }\r\n\r\n {if len(reportbody.rings) > 0:\r\n ringed\r\n }\r\n\r\n {reportbody.planettype}\r\n\r\n {if reportbody.terraformstate = \"Terraforming\":\r\n in the process of being terraformed\r\n }\r\n\r\n {if type(reportbody.landable) != \"void\": \r\n that is\r\n {if reportbody.landable:\r\n suitable\r\n |else:\r\n unsuitable\r\n }\r\n for landing\r\n }\r\n . {_ note the full stop}\r\n\r\n {_ Atmosphere? }\r\n\r\n {if reportbody.volcanism:\r\n This planet shows signs of volcanism, with\r\n {if reportbody.volcanism.type = 'Geysers':\r\n {if reportbody.volcanism.amount = 'Major':\r\n high numbers of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low numbers of\r\n }\r\n active {reportbody.volcanism.composition} geysers\r\n |else:\r\n {if reportbody.volcanism.amount = 'Major':\r\n high levels of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low levels of\r\n }\r\n active {reportbody.volcanism.composition} magma flows\r\n }.\r\n }\r\n\r\n {if reportbody.landable :\r\n It has a\r\n {if reportbody.rotationalperiod < -20.0:\r\n slow retrograde\r\n |elif reportbody.rotationalperiod < -0.5:\r\n retrograde\r\n |elif reportbody.rotationalperiod < 0:\r\n fast retrograde\r\n |elif reportbody.rotationalperiod <= 0.5:\r\n fast\r\n |elif reportbody.rotationalperiod > 20.0:\r\n slow\r\n }\r\n rotational period of {Humanise(reportbody.rotationalperiod)}\r\n day{if Humanise(reportbody.rotationalperiod) != \"1\":s}.\r\n\r\n {set goodmaterials to []}\r\n {set greatmaterials to []}\r\n {for material in reportbody.materials:\r\n {if material.percentage >= MaterialDetails(material.material).greatpctbody:\r\n {set greatmaterials to cat(greatmaterials, [material])}\r\n |elif material.percentage >= MaterialDetails(material.material).goodpctbody:\r\n {set goodmaterials to cat(goodmaterials, [material])}\r\n }\r\n }\r\n\r\n {if len(greatmaterials) > 0:\r\n This body contains very high levels of\r\n {if len(greatmaterials) = 1:\r\n {greatmaterials[0].material}\r\n |elif len(greatmaterials) = 2:\r\n {greatmaterials[0].material} and {greatmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(greatmaterials):\r\n {if cur = 0:\r\n {greatmaterials[cur].material}\r\n |elif cur < len(greatmaterials) - 1:\r\n , {greatmaterials[cur].material}\r\n |else:\r\n , and {greatmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(goodmaterials) > 0:\r\n {if len(greatmaterials) > 0:\r\n and high levels of\r\n |else:\r\n This body contains high levels of\r\n }\r\n {if len(goodmaterials) = 1:\r\n {goodmaterials[0].material}\r\n |elif len(goodmaterials) = 2:\r\n {goodmaterials[0].material} and {goodmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(goodmaterials):\r\n {if cur = 0:\r\n {goodmaterials[cur].material}\r\n |elif cur < len(goodmaterials) - 1:\r\n , {goodmaterials[cur].material}\r\n |else:\r\n , and {goodmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(greatmaterials) > 0 || len(goodmaterials) > 0:\r\n .\r\n }\r\n }\r\n}",
"default": true,
"name": "Body report",
"description": "Function to report on the details of the contextual body"
Expand Down Expand Up @@ -376,7 +376,7 @@
"priority": 3,
"responder": false,
"script": "{_ Data voucher awarded }\r\n{_ Triggered when you are awarded a data voucher }\r\n\r\n\r\n{_ Context }\r\n{SetState('eddi_context_last_subject', 'data_voucher')}\r\n{SetState('eddi_context_last_action', 'award')}\r\n{SetState('eddi_context_bond_amount', event.reward)}\r\n{SetState('eddi_context_bond_faction', event.payeefaction)}\r\n\r\nData voucher awarded from {event.payeefaction} for {event.reward} credits.\r\n",
"default": false,
"default": true,
"name": "Data voucher awarded",
"description": "Triggered when you are awarded a data voucher"
},
Expand Down

0 comments on commit 8176f7d

Please sign in to comment.