Skip to content

Commit

Permalink
Interact menu api overhaul. Scattered smaller changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent committed May 16, 2020
1 parent 5c1a994 commit 53d04f7
Show file tree
Hide file tree
Showing 32 changed files with 1,995 additions and 303 deletions.
6 changes: 4 additions & 2 deletions Support/Release_Specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

Release_Spec(
root_path = project_dir / 'extensions/sn_debug_info',
steam = False,
steam = True,
),

Release_Spec(
Expand Down Expand Up @@ -82,7 +82,9 @@
'documentation/Time_API.md':[
'lua/time/Interface.lua',
],
# TODO: context menu.
'documentation/Interact_Menu_API.md':[
'md/Interact_Menu_API.xml',
],
},
),

Expand Down
7 changes: 4 additions & 3 deletions Support/steam_versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"sn_remove_dock_symbol": "1.2",
"sn_station_kill_helper": "1.1",
"sn_interact_collection": "1.1",
"sn_extra_game_options": "1.7",
"sn_extra_game_options": "1.8",
"sn_better_target_monitor": "1.9",
"sn_mod_support_apis": "1.70",
"sn_mod_support_apis": "1.71",
"sn_remove_dock_glow": "1.2",
"sn_quiet_target_range_clicks": "1.1",
"sn_remove_blinking_lights": "1.3",
"sn_remove_dirty_glass": "1.2",
"sn_remove_highway_blobs": "0.1",
"sn_start_with_seta": "1.0"
"sn_start_with_seta": "1.0",
"sn_debug_info": "1.1"
}
4 changes: 4 additions & 0 deletions extensions/extensions.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@
<Content Include="sn_better_target_monitor\t\0001-L033.xml" />
<Content Include="sn_better_target_monitor\t\0001-L049.xml" />
<Content Include="sn_better_target_monitor\t\0001.xml" />
<Content Include="sn_debug_info\change_log.md" />
<Content Include="sn_debug_info\content.xml" />
<Content Include="sn_debug_info\md\sn_debug_info.xml" />
<Content Include="sn_extra_game_options\t\0001-L033.xml" />
<Content Include="sn_extra_game_options\t\0001-L049.xml" />
<Content Include="sn_extra_game_options\t\0001.xml" />
<Content Include="sn_friendlier_fire\change_log.md" />
<Content Include="sn_friendlier_fire\content.xml" />
Expand All @@ -107,6 +110,7 @@
<Content Include="sn_measure_perf\.gitignore" />
<Content Include="sn_measure_perf\lua\Measure_Perf.lua" />
<Content Include="sn_mod_support_apis\change_log.md" />
<Content Include="sn_mod_support_apis\documentation\Interact_Menu_API.md" />
<Content Include="sn_mod_support_apis\documentation\Simple_Menu_Options_API.md" />
<Content Include="sn_mod_support_apis\documentation\Time_API.md" />
<Content Include="sn_mod_support_apis\lua\Text.lua" />
Expand Down
5 changes: 3 additions & 2 deletions extensions/link_to_extensions.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ for %%F in (
sn_station_kill_helper

sn_debug_info

) do (
mklink /J "%x4_path%\%%F" "%src_path%\%%F"
)


REM test_interact_menu_api
REM test_simple_menu_api
REM test_hotkey_api
REM test_interact_menu_api
REM test_named_pipes_api
REM test_simple_menu_api
REM test_time_api
REM test_sector_resize
2 changes: 1 addition & 1 deletion extensions/sn_better_target_monitor/change_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Change Log
- Lua file now exports the text table, for users wanting to monkey-patch in alternate ship identifiers.
- German translation, by Le Leon.
* 1.8
- French translation update.
- French translation update, by Anthony.
* 1.9
- Russian translation, by aladinaleks
- Fixed content.xml text nodes.
7 changes: 7 additions & 0 deletions extensions/sn_debug_info/change_log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

Change Log

* 1.0
- Start of log.
* 1.1
- Added totals to station ware users.
4 changes: 2 additions & 2 deletions extensions/sn_debug_info/content.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<content
id="sn_debug_info"
id="ws_2097904592"
name="Debug Info"
description=" "
author="SirNukes"
version="100"
version="101"
date="2020-5-8"
save="false"
sync="false">
Expand Down
74 changes: 70 additions & 4 deletions extensions/sn_debug_info/md/SN_Debug_Info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,13 @@
<set_value name="$wares_consumers" exact="table[]"/>
<set_value name="$wares_traders" exact="table[]"/>
<set_value name="$wares_ships" exact="table[]"/>

<!--Counts of stations involved in each category.
Each station counts once, regardless of wares it uses.-->
<set_value name="$total_producers" exact="0"/>
<set_value name="$total_consumers" exact="0"/>
<set_value name="$total_traders" exact="0"/>
<set_value name="$total_ships" exact="0"/>


<!--Get all stations; also their build storage for now. -->
Expand All @@ -731,6 +738,17 @@

<!--Main loop to gather info.-->
<do_for_each name="$cont" in="$stations">

<!--Update counts.-->
<do_if value="$cont.products.list.count >= 1">
<set_value name="$total_producers" exact="1" operation="add"/>
</do_if>
<do_if value="$cont.resources.list.count >= 1">
<set_value name="$total_consumers" exact="1" operation="add"/>
</do_if>
<do_if value="$cont.tradewares.list.count >= 1">
<set_value name="$total_traders" exact="1" operation="add"/>
</do_if>

<!--Go through resources.-->
<do_for_each name="$ware" in="$cont.resources.list">
Expand Down Expand Up @@ -762,23 +780,27 @@
<!--Add all trade ships. -->
<include_actions ref="Lib_Get_Ships"/>
<do_for_each name="$ship" in="$ships">

<!--TODO: better info that captures ships when empty.-->
<do_for_each name="$ware" valuename="$amount" in="$ship .cargo.table">
<set_value name="$wares_consumers.{$ware}" exact="0" operation="add"/>
<set_value name="$wares_producers.{$ware}" exact="0" operation="add"/>
<set_value name="$wares_traders.{$ware}" exact="0" operation="add"/>
<set_value name="$wares_ships.{$ware}" exact="1" operation="add"/>
</do_for_each>

<do_if value="$ship.cargo.table.keys.list.count >= 1">
<set_value name="$total_ships" exact="1" operation="add"/>
</do_if>

<!--Check trade orders.-->
<do_for_each name="$order" in="$ship.tradeorders">
<!--TODO-->
</do_for_each>

</do_for_each>

<!--Check mining orders.-->

<!--Check mining orders. TODO-->
</do_for_each>


<!--TODO: figure out how to sort by ware name.
Most wares come out sorted naturally, but it appears to be by order
Expand Down Expand Up @@ -832,6 +854,50 @@
]"/>
<set_value name="$thickness" exact="2"/>
<include_actions ref="Lib_Add_Horizontal_Line"/>


<!--Row with summed values.-->
<signal_cue_instantly cue="md.Simple_Menu_API.Add_Row"/>
<signal_cue_instantly
cue="md.Simple_Menu_API.Make_Text"
param = "table[
$col = 1,
$text = 'Totals',
]"/>
<!--Loop over the four totals, each filling a column, 2-5.-->
<set_value name="$col" exact="2"/>
<do_for_each name="$total_count"
in="[$total_producers, $total_consumers,
$total_traders, $total_ships]">
<signal_cue_instantly
cue="md.Simple_Menu_API.Make_Text"
param = "table[
$col = $col,
$text = '%s'.[$total_count],
]"/>
<set_value name="$col" exact="1" operation="add"/>
</do_for_each>

<!--Removed in favor of actual overal station counts, as a station
can use multiple wares and so would multi-count in this approach.
<set_value name="$col" exact="2"/>
<do_for_each name="$ware_counts"
in="[$wares_producers, $wares_consumers,
$wares_traders, $wares_ships]">
<set_value name="$total_count" exact="0"/>
<do_for_each name="$ware" valuename="$count" in="$ware_counts">
<set_value name="$total_count" exact="$count" operation="add"/>
</do_for_each>
<signal_cue_instantly
cue="md.Simple_Menu_API.Make_Text"
param = "table[
$col = $col,
$text = '%s'.[$total_count],
]"/>
<set_value name="$col" exact="1" operation="add"/>
</do_for_each>-->


<!--Create the menu rows. Can loop on any table.-->
Expand Down
4 changes: 4 additions & 0 deletions extensions/sn_extra_game_options/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ Adds several new game options, accessible through the Extension Options page of

### Requirements
* Simple_Menu_API

### Contributors
* Anthony Bouquet - French translation
* Le Leon - German translation
6 changes: 5 additions & 1 deletion extensions/sn_extra_game_options/change_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Change Log
- Prevented experimental FoV slider from having unwanted effects.
* 1.6
- Fixed content.xml text nodes.
- French translation, by Anthony.
* 1.7
- Added mass traffic density option.
- Fixed auto mousover text losing some formatting (eg. underlines).
- Fixed auto mousover text losing some formatting (eg. underlines).
* 1.8
- Adjusted help text suppression to work during a pause.
- German translation, by Le Leon.
2 changes: 1 addition & 1 deletion extensions/sn_extra_game_options/content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name="Extra Game Options"
description=" "
author="SirNukes"
version="107"
version="108"
date="2020-3-12"
save="false"
sync="false">
Expand Down
18 changes: 8 additions & 10 deletions extensions/sn_extra_game_options/lua/Custom_Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ blackboard table instead of using signal params (limited to string/int/nil).
TODO: possible future options
- Reduce config.startAnimation.duration for faster open animations.
- Increase ui scaling factor beyond 1.5 (needs monkeypatch).
- Remove modified tag entirely.
- Remove modified tag entirely (text and parenthesis).
Requires accessing gameoptions config.optionDefinitions (private),
or monkeypatching wherever it gets used with a custom copy/pasted
version with the modified text function removed.
Expand All @@ -29,9 +29,7 @@ TODO: possible future options
a debug menu.
- Try out some global functions:
GetTrafficDensityOption / SetTrafficDensityOption
GetCharacterDensityOption
ClearLogbook
- Remove the egosoft station announcement
On page {10099,1014}.
Expand All @@ -45,11 +43,10 @@ TODO: possible future options
Note: most interesting stuff is in ui/core, but those don't see to be
exported despite being globals.
- Edit helptext.lua to suppress display of help messages. Should be simple
to intercept onShowHelp and onShowHelpMulti calls with doing nothing.
Main problem is that testing the edit would be annoying; need to find
a situation that consistently pops up the text. Probably will be
correct on first try, though.
- Higher ui scaling values
menu.valueGameUIScale, menu.callbackGameUIScaleReset()
Normally limited to 1.5x.
Maybe of little use; ui is already problematic at 1.5 with text cuttoffs.
]]

Expand Down Expand Up @@ -498,18 +495,19 @@ end

-- This gets checked on each onUpdate, looking for a time change.
L.helptext.delay_func = function()
if L.helptext.start_time ~= GetCurTime() then
if L.helptext.start_time ~= GetCurRealTime() then
L.helptext.clear_text_func()
end
end

-- Set up the onUpdate script, and record the start time.
-- TODO: switch to Time api for 1 frame delay alarm.
L.helptext.setup_func = function()
-- Note: several helptext calls may be done at once, seemingly,
-- so prevent excess calls to SetScript (clean up log).
if L.helptext.polling_active == false then
L.helptext.polling_active = true
L.helptext.start_time = GetCurTime()
L.helptext.start_time = GetCurRealTime()
SetScript("onUpdate", L.helptext.delay_func)
end
end
Expand Down
41 changes: 25 additions & 16 deletions extensions/sn_interact_collection/md/SN_Interact_Commands.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,34 @@
</actions>
</library>

<!-- Listen from the menu api reloading. -->
<cue name="Reset_On_Reload" instantiate="true">
<cue name="Add_Interact_Actions" instantiate="true">
<conditions>
<event_cue_signalled cue="md.Interact_Menu_API.Reloaded"/>
<event_cue_signalled cue="md.Interact_Menu_API.Get_Actions" />
</conditions>
<actions>
<include_actions ref="Load_Text"/>

<signal_cue_instantly
cue="md.Interact_Menu_API.Register_Action"
param = "table[
$id = 'target_follow',
$section = 'interaction',
$name = Text.$Follow,
$callback = Target_Follow,
$enabled_conditions = ['player_is_piloting'],
$disabled_conditions = ['~show_PlayerInteractions'],
]"/>
<set_value name="$texts" exact="event.param.$texts"/>
<set_value name="$target" exact="event.param.$object"/>

<!--TODO: load text on reloads or lua load.-->
<include_actions ref="Load_Text"/>

<!--Check that the player is piloting, and target is followable.-->
<!--TODO: maybe show_PlayerInteractions check.-->
<!--TODO: interaction doesn't support text2?-->
<do_if value="event.param.$showPlayerInteractions and $target.isclass.{class.destructible} ">
<signal_cue_instantly
cue="md.Interact_Menu_API.Add_Action"
param = "table[
$id = 'target_follow',
$section = 'interaction',
$text = Text.$Follow,
$text2 = $texts.$targetBaseOrShortName,
$mouseover = '%s %s'.[Text.$Follow, $target.name],
$icon = 'order_follow',
$mouseover_icon = 'order_follow',
$callback = Target_Follow,
]"/>
</do_if>
</actions>
</cue>

Expand All @@ -52,7 +61,7 @@
<start_player_autopilot destination="event.param.$object"/>
</actions>
</cue>

</cues>

</mdscript>
Expand Down
Loading

0 comments on commit 53d04f7

Please # to comment.