Git Product home page Git Product logo

threshingflowindicator's Introduction

threshingFlowIndicator

lua script for FS19 to visualize the current threshing flow

Author: HoFFi (modding-welt.com) Remarks: Thanks to Zetor6245 for testing and providing his Claas Jaguar 800 Pack as guinea pig Thanks to antonis78 who had the initial idea for this script and who gave me the motivation to continue with lua

Description: script to visualize the current threshing flow

Version: 1.0.2.0

Changelog:

2019-08-08 	- initial release
2019-08-12 	- added more complex way of showing the current load (indicator bar with 13 lights)
2019-08-27 	- hud / help window text, has been improved
		- cutter load depends on…: fruit type, current speed, used width of cutter
		- max. speed of each fruit is easily adjustable in below
		- engine dies, warn sound is played and warning text is showed when driving too fast (allowed fruit speed + tolerance)
		- tolerance adjustable via xml (default 2kmh/mph)
		- “hardStop” (engine dies) can be turned off in xml

Mod-XML:

<threshingFlowIndicator indicatorBarNode="name of bar in i3d" showInHud="true" hardStop="true" maxSpeedOffset="2">
	<lights light1="greenstarON01" light2="greenstarON02" light3="greenstarON03" light4="greenstarON04" light5="greenstarON05" light6="greenstarON06" light7="greenstarON07" light8="greenstarON08" light9="greenstarON09" light10="greenstarON10" light11="greenstarON11" light12="greenstarON12" light13="greenstarON13" />
</threshingFlowIndicator>

Moddesc:

  <vehicleTypes>
	    <type name="newVehicleTypeName" parent="...." filename="$dataS/scripts/vehicles/Vehicle.lua">
		      ....
		      <specialization name="threshingFlowIndicator" />
	    </type>
  </vehicleTypes>

  <l10n>
	    <text name="TFIspeed"><en>Max. speed:</en><de>Max. Geschw.:</de></text>
	    <text name="TFIcutterLoad"><en>Load (cutter):</en><de>Auslastung (Schneidwerk):</de></text>
	    <text name="TFItooFast"><en>You drove too fast. Engine died.</en><de>Du bist zu schnell gefahren. Motor abgesoffen.</de></text>
  </l10n>

Explaination:

indicatorBarNode = visual object (bar) to be scaled
showInHud = if true, current flow will be displayed in hud (help menu)
hardStop = if true, motor stops if current speed is higher than allowed maximum speed for a fruit + maxSpeedOffset
maxSpeedOffset = this value is added to the maximum allowed speed per fruit as tolerance before motor stops 

threshingflowindicator's People

Contributors

da-hoffi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

looglecz

threshingflowindicator's Issues

Code cleanup: use namespace for internal values

This scripts uses directly self as an storage for new values (that are needed internally for the script purposes). This may bring potential break in the future as keys used by this script can be taken also by other script. I'd suggest to use "namespacing" and put the values for this script-only into such namespace. For example, if you have this

function threshingFlowIndicator:onLoad(savegame)
	self.hardStop = ....
end;

and then you will have another script, that also operates with self.hardStop, you have problem as those values will collide and the value defined later will take precedence (on load, when in game directly, it depends on internal logic of scripts).

So in my oppinion it is better to use something like this:

function threshingFlowIndicator:onLoad(savegame)
	self.DFI = {}; -- shortcut from 'Da-hoffi Flow Indicator'
	self.DFI.hardStop = ....
end;

This will prevent collisions as there are small chance any other author will use DFI as namespace. Of course namespace could be as long as you want, but for my convenience, I use three letters (author's first letter and then two letters for script identification).

Make possible to configure speed values via vehicle's xml file

As of now, "end user" (the modder) is forced to modify the script file directly. This is inconvenient and introduces possible risk of failure when entering new values.

Goal of this issue

Add loading of the values form XML configuration, so user will need to change only XML file, not the script directly.

Code cleanup: unused method

Methods:

  • threshingFlowIndicator:onDelete
  • threshingFlowIndicator:onReadStream
  • threshingFlowIndicator:onWriteStream

are not used and thus can be removed.

Code cleanup: Allow dynamic number of lights as well as fruit types

Current script do not allow to have any other number of lights than 12. It also forces to use only predefined fruit types. Feature can be extended to allow any number of lights as well as any number of fruit types.

Goal is to load fruit types (or lights) dynamically from vehicle's xml configuration and in the script to have olny default, fallback values.

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.