Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fertilizerHose extension #196

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ hoses affects your pump time.

## Known conflicts

* [Contact modder] [3rd Person](https://www.farming-simulator.com/mod.php?mod_id=234226)
* [Contact modder/Worked around] [3rd Person](https://www.farming-simulator.com/mod.php?mod_id=234226)
* Unfortunately, that mod replaces the Player.update() code, breaking any mods that depend on/add to that call. Contact the modder to mention that Utilly functions such as `overwriteFunction` and `appendedFunction` should be used instead.
* [Contact modder] [Precision Hands](https://www.farming-simulator.com/mod.php?mod_id=265312)
This has now been worked around. However, the 3rd Person mod in its current state replaces any fixes done by Giants in the future, therefore the modder should still be contacted.
* [Contact modder/Worked around] [Precision Hands](https://www.farming-simulator.com/mod.php?mod_id=265312)
* Sadly, that mod does not overwrite the Player.pickUpObject() function correctly by not calling the superFunc, therefor making the hose grap and drop functions unreachable. Contact the modder to mention that the superFunc should be called to maintain comptible with other any other mod relaying on that function.
This has now been worked around. However, the Precision Hands mod in its current state replaces any fixes done by Giants in the future, therefore the modder should still be contacted.
* [Fixed] [Mobile Workshop](https://www.farming-simulator.com/mod.php?mod_id=225545)
* Removed obsolete FS19 code in Manure System, please download the latest version of the Manure System

Expand Down
93 changes: 50 additions & 43 deletions resources/hoses/fertilizer/fertilizerHose.i3d
Original file line number Diff line number Diff line change
@@ -1,64 +1,71 @@
<?xml version="1.0" encoding="iso-8859-1"?>

<i3D name="fertilizerHose" version="1.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://i3d.giants.ch/schema/i3d-1.6.xsd">
<i3D name="fertilizerHose.i3d" version="1.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://i3d.giants.ch/schema/i3d-1.6.xsd">
<Asset>
<Export program="GIANTS Editor 64bit" version="9.0.6"/>
</Asset>

<Files>
<File fileId="3" filename="$data/shaders/vehicleShader.xml" />
<File fileId="5" filename="../coupling_gloss.png" />
<File fileId="4" filename="../coupling_normal.png" />
<File fileId="2" filename="../hose_gloss.png" />
<File fileId="1" filename="../hose_normal.png" />
<File fileId="4" filename="$data/shaders/vehicleShader.xml"/>
<File fileId="3" filename="../coupling_gloss.png"/>
<File fileId="2" filename="../coupling_normal.png"/>
<File fileId="9" filename="../hose_gloss.png"/>
<File fileId="8" filename="../hose_normal.png"/>
</Files>


<Materials>
<Material name="lambert1" materialId="1" diffuseColor="0.5 0.5 0.5 1">
<Material name="coupling_mat" materialId="76" diffuseColor="0.494118 0.494118 0.494118 1" customShaderId="4" customShaderVariation="colorMask">
<Normalmap fileId="2"/>
<Glossmap fileId="3"/>
<CustomParameter name="RDT" value="1 1 0 0"/>
<CustomParameter name="colorMat1" value="0.05 0.05 0.05 1"/>
</Material>
<Material name="hose_mat" materialId="3" diffuseColor="0.5 0.5 0.5 1" customShaderId="3" customShaderVariation="localCatmullRom_colorMask_uvScale">
<CustomParameter name="uvScale" value="1.0 1.5 0.0 0.0"/>
<Material name="hose_mat" materialId="77" diffuseColor="0.494118 0.494118 0.494118 1" customShaderId="4" customShaderVariation="localCatmullRom_colorMask_uvScale">
<Normalmap fileId="8"/>
<Glossmap fileId="9"/>
<CustomParameter name="RDT" value="1 1 0 0"/>
<CustomParameter name="uvScale" value="1 1.5 0 0"/>
<CustomParameter name="lengthAndDiameter" value="5 1 0 0"/>
<CustomParameter name="RDT" value="1.0 1.0 0.0 0.0"/>
<CustomParameter name="colorMat0" value="0.80 0.55 0.05 1.0"/>
<CustomParameter name="dirtColor" value="0.20 0.14 0.08 0.0"/>
<Normalmap fileId="1"/>
<Glossmap fileId="2"/>
</Material>
<Material name="coupling_mat" materialId="2" diffuseColor="0.5 0.5 0.5 1" customShaderId="3" customShaderVariation="colorMask">
<CustomParameter name="RDT" value="1.0 1.0 0.0 0.0"/>
<CustomParameter name="dirtColor" value="0.20 0.14 0.08 0.0"/>
<CustomParameter name="colorMat1" value="0.05 0.05 0.05 1.0"/>
<Normalmap fileId="4"/>
<Glossmap fileId="5"/>
<Material name="lambert1" materialId="78" diffuseColor="0.494118 0.494118 0.494118 1">
</Material>
</Materials>


<Shapes externalShapesFile="fertilizerHose.i3d.shapes">
</Shapes>


<Dynamics>
</Dynamics>

<Scene>
<Shape name="hose_main_component1" translation="0 0 -0" shapeId="1" dynamic="true" compound="true" collisionMask="2109442" castsShadows="true" receiveShadows="true" nonRenderable="true" materialIds="1" clipDistance="300" nodeId="1">
<Shape name="fertilizer_coupling_camplock_1" translation="0 0 0" rotation="0 180 0" shapeId="2" castsShadows="true" receiveShadows="true" materialIds="2" clipDistance="300" nodeId="2"/>
<Shape name="fertilizer_coupling_1" translation="0 0 0" rotation="0 180 0" visibility="false" shapeId="3" castsShadows="true" receiveShadows="true" materialIds="2" clipDistance="300" nodeId="3"/>
<Shape name="fertilizer_hose" translation="0 0 -0.242" rotation="0 180 0" shapeId="4" castsShadows="true" receiveShadows="true" materialIds="3" clipDistance="300" nodeId="4"/>
<TransformGroup name="grabNode1" translation="0 0 0" nodeId="5"/>
<TransformGroup name="baseNode" translation="0 0 0" rotation="0 180 0" nodeId="6"/>
<TransformGroup name="componentJoint1" translation="0 0 -1.848" nodeId="7"/>
<Shape name="pCylinder1" translation="0 -0 -0.064493" shapeId="5" compoundChild="true" density="0.001" collisionMask="8194" castsShadows="true" receiveShadows="true" nonRenderable="true" materialIds="1" nodeId="8"/>
</Shape>
<Shape name="hose_main_component2" translation="0 0 -1.928" shapeId="6" dynamic="true" compound="true" collisionMask="2109442" castsShadows="true" receiveShadows="true" nonRenderable="true" materialIds="1" clipDistance="300" nodeId="9">
<TransformGroup name="componentJoint2" translation="0 0 -1.548" nodeId="10"/>
</Shape>
<Shape name="hose_main_component3" translation="0 0 -3.556" shapeId="7" dynamic="true" compound="true" collisionMask="2109442" castsShadows="true" receiveShadows="true" nonRenderable="true" materialIds="1" clipDistance="300" nodeId="11">
<TransformGroup name="componentJoint3" translation="-0 -0 -1.848323" nodeId="12"/>
</Shape>
<Shape name="hose_main_component4" translation="0 0 -5.484195" shapeId="8" dynamic="true" compound="true" collisionMask="2109442" castsShadows="true" receiveShadows="true" nonRenderable="true" materialIds="1" clipDistance="300" nodeId="13">
<TransformGroup name="grabNode2" translation="-0 0 0" rotation="0 180 0" nodeId="14"/>
<TransformGroup name="targetNode" translation="0 0 0.242" rotation="0 180 0" nodeId="15"/>
<Shape name="fertilizer_coupling_camplock_2" translation="0 0 0" shapeId="9" castsShadows="true" receiveShadows="true" materialIds="2" clipDistance="300" nodeId="16"/>
<Shape name="fertilizer_coupling_2" translation="0 0 0" visibility="false" shapeId="10" castsShadows="true" receiveShadows="true" materialIds="2" clipDistance="300" nodeId="17"/>
</Shape>
<Shape shapeId="1" name="hose_main_component1" dynamic="true" compound="true" collisionMask="2109442" clipDistance="300" nodeId="87" materialIds="78" castsShadows="true" receiveShadows="true" nonRenderable="true">
<Shape shapeId="2" name="fertilizer_coupling_camplock_1" rotation="180 -5.00896e-06 180" clipDistance="300" nodeId="88" materialIds="76" castsShadows="true" receiveShadows="true"/>
<Shape shapeId="3" name="fertilizer_coupling_1" translation="-1.64373e-08 0 -0.188021" rotation="0 180 0" visibility="false" clipDistance="300" nodeId="89" materialIds="76" castsShadows="true" receiveShadows="true"/>
<Shape shapeId="4" name="fertilizer_hose" translation="0 0 -0.242" rotation="0 180 0" clipDistance="300" nodeId="90" materialIds="77" castsShadows="true" receiveShadows="true"/>
<TransformGroup name="grabNode1" nodeId="91"/>
<TransformGroup name="baseNode" rotation="0 180 0" nodeId="92"/>
<TransformGroup name="componentJoint1" translation="0 0 -1.848" nodeId="93"/>
<Shape shapeId="5" name="pCylinder1" translation="0 -0 -0.064493" compoundChild="true" collisionMask="8194" density="0.001" nodeId="94" materialIds="78" castsShadows="true" receiveShadows="true" nonRenderable="true"/>
<TransformGroup name="grabNodeExt1" translation="-1.64373e-08 0 -0.188021" nodeId="107"/>
<TransformGroup name="baseNodeExt1" translation="-1.64373e-08 0 -0.188021" rotation="180 -5.00896e-06 180" nodeId="108"/>
</Shape>
<Shape shapeId="6" name="hose_main_component2" translation="0 0 -1.928" dynamic="true" compound="true" collisionMask="2109442" clipDistance="300" nodeId="95" materialIds="78" castsShadows="true" receiveShadows="true" nonRenderable="true">
<TransformGroup name="componentJoint2" translation="0 0 -1.548" nodeId="96"/>
</Shape>
<Shape shapeId="6" name="hose_main_component3" translation="0 0 -3.556" dynamic="true" compound="true" collisionMask="2109442" clipDistance="300" nodeId="97" materialIds="78" castsShadows="true" receiveShadows="true" nonRenderable="true">
<TransformGroup name="componentJoint3" translation="-0 -0 -1.84832" nodeId="98"/>
</Shape>
<Shape shapeId="7" name="hose_main_component4" translation="0 0 -5.48419" dynamic="true" compound="true" collisionMask="2109442" clipDistance="300" nodeId="99" materialIds="78" castsShadows="true" receiveShadows="true" nonRenderable="true">
<TransformGroup name="grabNode2" rotation="0 180 0" nodeId="100"/>
<TransformGroup name="targetNode" translation="0 0 0.242" rotation="0 180 0" nodeId="101"/>
<Shape shapeId="2" name="fertilizer_coupling_camplock_2" clipDistance="300" nodeId="102" materialIds="76" castsShadows="true" receiveShadows="true"/>
<Shape shapeId="3" name="fertilizer_coupling_2" translation="0 0 0.18796" visibility="false" clipDistance="300" nodeId="103" materialIds="76" castsShadows="true" receiveShadows="true"/>
<TransformGroup name="grabNodeExt2" translation="0 0 0.18796" rotation="-180 -5.00896e-06 -180" nodeId="109"/>
<TransformGroup name="targetNodeExt2" translation="-1.63806e-08 -1.63404e-08 0.242588" rotation="180 -5.00896e-06 180" nodeId="110"/>
</Shape>
</Scene>

<UserAttributes>
</UserAttributes>
</i3D>
Binary file modified resources/hoses/fertilizer/fertilizerHose.i3d.shapes
Binary file not shown.
46 changes: 46 additions & 0 deletions resources/hoses/fertilizer/fertilizerHose.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,45 @@
<visuals visualNode="fertilizer_coupling_camplock_2" hoseTargetNode="targetNode"/>
</grabNode>
</grabNodes>

<objectChange node="fertilizer_coupling_camplock_1" visibilityActive="true"/>
<objectChange node="fertilizer_coupling_camplock_2" visibilityActive="true"/>
<objectChange node="fertilizer_coupling_1" visibilityActive="false"/>
<objectChange node="fertilizer_coupling_2" visibilityActive="false"/>
</manureSystemHoseConfiguration>

<manureSystemHoseConfiguration name="$l10n_configuration_valueExtend" price="10">
<grabNodes>
<grabNode isExtension="true" node="grabNodeExt1" raycastNode="grabNodeExt1" componentIndex="1" componentJointIndex="1">
<visuals visualNode="fertilizer_coupling_1" hoseTargetNode="fertilizer_hose" updateHoseTargetRotation="true"/>
</grabNode>
<grabNode node="grabNode2" raycastNode="grabNode2" componentIndex="4" componentJointIndex="3">
<visuals visualNode="fertilizer_coupling_camplock_2" hoseTargetNode="targetNode"/>
</grabNode>
</grabNodes>

<objectChange node="fertilizer_coupling_camplock_1" visibilityActive="false"/>
<objectChange node="fertilizer_coupling_camplock_2" visibilityActive="true"/>
<objectChange node="fertilizer_coupling_1" visibilityActive="true"/>
<objectChange node="fertilizer_coupling_2" visibilityActive="false"/>
<objectChange node="pCylinder1" translationActive="0 0 -0.188"/>
</manureSystemHoseConfiguration>

<manureSystemHoseConfiguration name="$l10n_configuration_valueExtend" price="10">
<grabNodes>
<grabNode isExtension="true" node="grabNodeExt1" raycastNode="grabNodeExt1" componentIndex="1" componentJointIndex="1">
<visuals visualNode="fertilizer_coupling_1" hoseTargetNode="fertilizer_hose" updateHoseTargetRotation="true"/>
</grabNode>
<grabNode isExtension="true" node="grabNodeExt2" raycastNode="grabNodeExt2" componentIndex="4" componentJointIndex="3">
<visuals visualNode="fertilizer_coupling_2" hoseTargetNode="targetNode"/>
</grabNode>
</grabNodes>

<objectChange node="fertilizer_coupling_camplock_1" visibilityActive="false"/>
<objectChange node="fertilizer_coupling_camplock_2" visibilityActive="false"/>
<objectChange node="fertilizer_coupling_1" visibilityActive="true"/>
<objectChange node="fertilizer_coupling_2" visibilityActive="true"/>
<objectChange node="pCylinder1" translationActive="0 0 -0.188"/>
</manureSystemHoseConfiguration>
</manureSystemHoseConfigurations>
</hose>
Expand Down Expand Up @@ -107,5 +146,12 @@
<i3dMapping id="targetNode" node="3>1" />
<i3dMapping id="fertilizer_coupling_camplock_2" node="3>2" />
<i3dMapping id="fertilizer_coupling_2" node="3>3" />

<i3dMapping id="pCylinder1" node="0>6" />
<i3dMapping id="grabNodeExt1" node="0>7" />
<i3dMapping id="baseNodeExt1" node="0>8" />
<i3dMapping id="grabNodeExt2" node="3>4" />
<i3dMapping id="targetNodeExt2" node="3>5" />

</i3dMappings>
</vehicle>
40 changes: 40 additions & 0 deletions resources/insertionPlaceables/pumpsNHosesPack.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
<manureSystemConnectors>
<connector>
<entry type="string" key="#type" value="COUPLING"/>
<entry type="string" key="#fillTypes" value="LIQUIDMANURE"/>
<entry type="string" key="#componentNode" value="0>2|0"/>

<entry type="int" key=".sharedSet#id" value="2"/>
Expand All @@ -239,9 +240,48 @@
<entry type="string" key=".sharedSet.valve#type" value="8INCH_BRASS"/>
<entry type="string" key=".sharedSet.handle#type" value="HANDLE_NEW"/>
</connector>
<connector>
<entry type="string" key="#type" value="COUPLING"/>
<entry type="string" key="#fillTypes" value="DIGESTATE"/>
<entry type="string" key="#componentNode" value="0>2|0"/>

<entry type="int" key=".sharedSet#id" value="2"/>
<entry type="bool" key=".sharedSet#createNode" value="true"/>
<entry type="string" key=".sharedSet#placeholderNode" value="0>10|1"/>
<entry type="string" key=".sharedSet#linkNode" value="0>10"/>
<entry type="string" key=".sharedSet#position" value="-4.4749999 0.49079639 5.19866467"/>
<entry type="string" key=".sharedSet#rotation" value="0 230 0"/>
<entry type="string" key=".sharedSet.connector#type" value="CONNECTOR_1"/>
<entry type="string" key=".sharedSet.valve#type" value="8INCH_BRASS"/>
<entry type="string" key=".sharedSet.handle#type" value="HANDLE_NEW"/>
</connector>
</manureSystemConnectors>
</placeable>

<!-- <placeable xml="data/placeables/stallkamp/fermenters/fermenter20m.xml"> -->
<!-- <manureSystem> -->
<!-- <entry type="bool" key="#hasConnectors" value="true"/> -->
<!-- </manureSystem> -->

<!-- <manureSystemConnectors> -->
<!-- <connector> -->
<!-- <entry type="string" key="#type" value="COUPLING"/> -->
<!-- <entry type="string" key="#fillTypes" value="DIGESTATE"/> -->
<!-- <entry type="string" key="#componentNode" value="0>2|0"/> -->

<!-- <entry type="int" key=".sharedSet#id" value="2"/> -->
<!-- <entry type="bool" key=".sharedSet#createNode" value="true"/> -->
<!-- <entry type="string" key=".sharedSet#placeholderNode" value="0>0|4|0"/> -->
<!-- <entry type="string" key=".sharedSet#linkNode" value="0>0|4"/> -->
<!-- <entry type="string" key=".sharedSet#position" value="-3.49499989 1.19373441 10.21744061"/> -->
<!-- <entry type="string" key=".sharedSet#rotation" value="0 250 0"/> -->
<!-- <entry type="string" key=".sharedSet.connector#type" value="CONNECTOR_1"/> -->
<!-- <entry type="string" key=".sharedSet.valve#type" value="8INCH_BRASS"/> -->
<!-- <entry type="string" key=".sharedSet.handle#type" value="HANDLE_NEW"/> -->
<!-- </connector> -->
<!-- </manureSystemConnectors> -->
<!-- </placeable> -->

<placeable xml="data/placeables/stallkamp/tankFlatSteel/tankOpen19m.xml">
<manureSystem>
<entry type="bool" key="#hasConnectors" value="true"/>
Expand Down
10 changes: 8 additions & 2 deletions src/hose/HosePlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@ function HosePlayer.new(isClient, isServer, mission, input)

Player.readUpdateStream = Utils.appendedFunction(Player.readUpdateStream, HosePlayer.inj_player_readUpdateStream)
Player.writeUpdateStream = Utils.appendedFunction(Player.writeUpdateStream, HosePlayer.inj_player_writeUpdateStream)
Player.update = Utils.appendedFunction(Player.update, HosePlayer.inj_player_update)
Player.onLeave = Utils.appendedFunction(Player.onLeave, HosePlayer.inj_player_onLeave)

-- Workaround for mod conflicts caused by Precision Hands and 3rdPerson mods:
-- Delay the method override so the other mods can't replace our code.
Mission00.loadMission00Finished = Utils.appendedFunction(Mission00.loadMission00Finished, function(...)
Player.update = Utils.appendedFunction(Player.update, HosePlayer.inj_player_update)
Player.pickUpObject = Utils.overwrittenFunction(Player.pickUpObject, HosePlayer.inj_player_pickUpObject)
end)

Player.updateActionEvents = Utils.appendedFunction(Player.updateActionEvents, HosePlayer.inj_player_updateActionEvents)
Player.registerActionEvents = Utils.prependedFunction(Player.registerActionEvents, HosePlayer.inj_player_registerActionEvents)

Player.pickUpObject = Utils.overwrittenFunction(Player.pickUpObject, HosePlayer.inj_player_pickUpObject)


Player.checkObjectInRange = Utils.overwrittenFunction(Player.checkObjectInRange, HosePlayer.inj_player_checkObjectInRange)
PlayerStateThrow.isAvailable = Utils.overwrittenFunction(PlayerStateThrow.isAvailable, HosePlayer.inj_playerStateThrow_isAvailable)
Expand Down