Commit Graph

617 Commits (bce903ee0434ffae24bf02c898ab456adee9ffdf)

Author SHA1 Message Date
Mark dd7bf3e89e Merge remote-tracking branch 'origin/master' into liquid_container
Conflicts will be merged in the next commit:
	planet/Objects.ocd/Items.ocd/Tools.ocd/Pipe.ocd/PipeLine.ocd/Script.c
	planet/Objects.ocd/Items.ocd/Tools.ocd/Pipe.ocd/Script.c
2016-03-25 17:15:39 +01:00
Mark 18ad5894e2 Producers: Producers can convert ice to water
This special case is a relic, because I do not know whether this is actually a use case that is required in a scenario. All unit tests in the producers test pass now.
2016-03-24 16:19:15 +01:00
Mark 02b8cf8422 Barrel: Fixed barrel getting filled with liquids
Barrels was not updating, and caused an error when getting filled with liquid.
2016-03-23 20:11:23 +01:00
Maikel de Vries bf1b65c8bd fix loam usage bar margins 2016-03-22 22:12:36 +01:00
Maikel de Vries 7693276a48 implement max length for pipe and show it in inventory HUD 2016-03-22 22:09:02 +01:00
Maikel de Vries fc008241cd rename LineBreak callback to OnLineBreak 2016-03-22 18:58:55 +01:00
Lukas Werling acc04b2398 Improve default Use/Throw angles when not aiming 2016-03-22 18:56:31 +01:00
Lukas Werling 0afa589286 Replace all usage of "bool released" with "int status" 2016-03-21 18:45:42 +01:00
Mark a95694ea23 Bugfix: Earth is not initialized properly.
This bug did previously not appear, because the stack count did always return a minimum of 1. May add unit test with all stackable items later.
2016-03-17 22:42:49 +01:00
Mark a2700890ce Refactoring: Unit test for liquid containers uses doTest()
This is more readable and failures can be identified more easily.
2016-03-17 18:13:40 +01:00
Mark 7febb8fd91 Refactoring: Stackable: The size of stacks can be limited by a container now.
The function RejectEntrance() has two more callbacks to the object it should enter:
- CollectFromStack(object stack): The object can grab items from the stack, before the stack tries to merge with stacks in the object. This is necessary for barrels, so that a large liquid stack can fill an empty barrel.
- RejectStack(object stack): This is called after the stack is merged. Currently, the stack merging counts as handled only if the stack is removed. This callback allows the object to still reject the stack, for example if it accepts only one item, such as the barrel does.
2016-03-16 22:43:44 +01:00
Mark ac8d40418c Refactoring: Stackable: Renamed TryPutInto() to MergeWithStacksIn()
The previous name suggested that the object actually gets put into another object. In fact it merges the stack count with other stacks, and it does not only try to (and reverts the state if it fails), but it actually changes other objects even if the function returns false.
2016-03-16 18:19:55 +01:00
Mark 96e59a0626 Failed attempt at unit test nr. 6 2016-03-03 22:10:10 +01:00
Mark 1786f5b3d9 Liquid objects: Fix unit test, Stackable
Addedv debugging logs, will remove them once all unit tests work. The stackable library function "TryPutInto" was changed slightly.
2016-03-03 17:10:43 +01:00
Mark a7ed516c39 Refactoring: Liquid container
The liquid container library was severely reduced by the changes that the liquid objects bring. The remaining unit tests nearly work.
2016-03-01 22:29:35 +01:00
Mark f78890142c Refactoring: Fuel
Added parameter to 'GetFuelAmount' that specified how much fuel is requested from this object. Oil is now fuel and only the needed amount is removed instead of removing the entire stack when a producer requests fuel.
2016-03-01 17:29:24 +01:00
Mark 072f599cdb Refactoring fuel: Removed the 'get_partial' parameter.
This was used inconsistently and without regard to correctness, so it is better removed altogether. In case of incomplete objects, the incomplete object always returns the reduced amount.
2016-03-01 17:19:39 +01:00
Mark 3591681f32 Liquid objects: Removed check liquid logic from producer
The liquid objects cannot be converted from one to another. The fuel object will be removed again, it does not make sense that "burnt fuel" can be transferred from one object to another.
2016-03-01 06:47:12 +01:00
Mark 0536520bc8 Refactoring: Liquid object stackable
Made the liquid object stackable again. Will replace component amounts in the next step.
2016-02-29 21:40:45 +01:00
Nicolas Hake fe91cec2b7 Merge remote-tracking branch 'github/pull/14' 2016-02-29 14:05:45 +01:00
Mark af6a31c489 Merge remote-tracking branch 'master' into liquid_container 2016-02-20 21:17:59 +01:00
Mark d0cf26490e Removed unused function from erroneous merge 2016-02-20 17:31:26 +01:00
Mark 2dd09fc8bd Liquid Object: Dispersing contents is a function of the liquid object now, instead of the barrel
The object now also disperses if it exits a liquid container
2016-02-20 17:08:55 +01:00
Maikel de Vries 4be356f4d9 diamonds: add option to place them not in groups 2016-02-19 22:13:09 +01:00
Maikel de Vries a0a5d98700 teleglove: add callback to reject control 2016-02-19 22:13:09 +01:00
Mark 91adb6140a Fix/merge from rebase: BarrelIntake as property 2016-02-16 21:16:32 +01:00
Mark 651f5c806b Refactoring: Steam engine liquid extraction
The steam engine treats barrels the same as itself when it comes to extracting liquids. This removes the need for the callback OnFuelRemoved() in the barrel, as well as the stupid definition call from the barrel to the steam engine.
2016-02-16 21:07:46 +01:00
Mark fb397618df Failsafe barrel names 2016-02-16 21:07:36 +01:00
Mark 6f7152eba6 Fixed bug in barrel stacking and added a unit test for this use case 2016-02-16 21:07:31 +01:00
Mark 8e692a25c4 Use property instead of function for barrel intake 2016-02-16 21:07:17 +01:00
Mark 1f54927aee Unit test for line connections 2016-02-16 21:04:11 +01:00
Mark a0fb0473b3 Barrels function as fuel now.
The steam engine does not remove the barrels, it just empties them. Made power system unit test 19 end if both pumps are pumping, this seems to be the intention of the unit test. Added power system unit test 20: Steam engine fueled by oil barrels.
2016-02-16 21:04:01 +01:00
Mark 07b242d6b1 Barrels accept oil 2016-02-16 21:03:52 +01:00
Mark e985ffbd45 Changed pipe interface
- connect / disconnect callbacks do not include the line anymore
- the drain and source pipes are set to the pipe now, instead of the line
2016-02-16 21:03:43 +01:00
Mark 06f3e26ad5 Bugfix: Errors in UnitTest upon destruction of the pipe 2016-02-16 21:03:29 +01:00
Mark d6f600bbd2 Bugfix: Message displayed above clonk, instead of connected structure 2016-02-16 21:03:24 +01:00
Mark e99ab4471a Refactoring: Completely remodeled pipe interface
Pipes can connect to nearly anything now. The connecting object is responsible for rejecting the connection.
2016-02-16 21:03:20 +01:00
Mark 4d2a661763 Analysis: Pipe object
The pipe object is very convoluted at the moment. Worked out some requirements for the object and will implement many things in a clean way.
2016-02-16 21:03:15 +01:00
Mark 371fdaeaa6 Refactoring: Pump interface names
The pump uses the same function names as the liquid tank now. This is a preparation for the consolidation of the two.
2016-02-16 21:02:56 +01:00
Mark cc2b0aa15b Connection in Liquid Tank
The liquid tank can connect and deconnect lines properly now
2016-02-16 21:02:37 +01:00
Mark 97bdd342fc Refactoring: Pump, pipe, better menu handling
The pipe can be connected from the interaction menu now, too. Expanded the disconnection logic, because more problems arise when the pipe can still be connected to other structures - it would be sufficient to remove the line, but that could be annoying:
- if the pipe is connected to a container, then you can disconnect the pipe from that liquid tank and it will still be connected to the pump
- if you disconnect the pipe from the pump, then it will disconnect from the liquid tank as well

Maybe this is confusing to the user, we can still kick that out later again.
2016-02-16 21:02:32 +01:00
Mark fbdd5eeb09 Refactoring: Pimp, Pipe, SteamEngine
Now it is possible to connect lines from a pump to the steam engine. This is achieved by the steam engine being a liquid tank. It did not seem good to allow connection from pumps to all liquid containers (i.e. barrels). A liquid tank is also a liquid container, they share the same interface, but it is also a structure.

It is not yet possible to fill the steam engine with any liquid though, because it is not defined what kind of liquid it accepts. This will be oil in the future. Furthermore, the behaviour when the pump adds incompatible liquid is not defined yet.
2016-02-16 21:02:28 +01:00
Mark 6f557520e8 Refactoring: Renamed Set/GetLiquidName to Set/GetLiquidType 2016-02-16 21:02:09 +01:00
Mark 9a8c3f4fea Refactoring: Barrel fill with liquid
The function had some crazy checks and delegation, now everything is in one function
2016-02-16 21:02:04 +01:00
Mark 9d17cff91e Refactoring: Removed old barrel functions
Replaced old barrel functions with the liquid container library calls
2016-02-16 21:01:59 +01:00
Mark 2f5cc035b6 Library: Liquid Container
Added unit test.
2016-02-16 21:01:55 +01:00
Mark b64a0e852a Library: Liquid Container
Added a new library for liquid containers that is based on the original barrel script.

Library_LiquidContainer
- Extracted the interface from the barrel. The function names and argument types are not final yet.
- Fixed an inconsistency in the script: There were two ways of determining whether a barrel is suited
   for a material. Either by name, or material index.
- renamed argument names to "liquid_name" for liquids, "amount" for quantities, so that the code is more easily understandable
- replaced comparison 'fill level > 0' with 'is not empty?'
- moved storage variables to a local proplist, so that names do not clash
- Ordered the methods by application and documented each section

Barrel:
- The original barrel functions delegate to Library_LiquidContainer-functions now, so that the original functionality is not disturbed. Obsolete functions are marked with "TODO: deprecated".
- Moved barrel value change to the update function
- Moved hit sound effect to separate function
- Replaced uses of the magic number '3' with a runtime-overloadable call to GetBarrelIntakeY()
- Replaced comparison 'fill level > 0' with 'is not empty?'

MetalBarrel:
- Adjusted the hit function. The difference between this and the normal barrel is the hit sound and material position. These should be constants or functions, instead of magic numbers
- Moved hit sound effect to separate function
- Removed the Hit()-function, because the hit sound is played in a separate function now
- With this change the y-offset of the barrel checking for other liquids on a hit is now 3 instead of 7. This should be ok, because the barrels have the same dimensions, it seemed strange that they would have different offsets
2016-02-16 21:01:50 +01:00
Maikel de Vries 1b94d0fcc8 reduce javelin damage
This way it really does what was promised in the last commit (ac8d5934), and not kill someone with 2 good throws.
2016-02-14 18:31:39 +01:00
Maikel de Vries b7766780c5 fix plane for several C4D_None objects which where C4D_Structure before 2016-02-10 22:40:44 +01:00
Lukas Werling 29491ec3b7 Replace lots of empty parameters with proplist for Sound() 2016-02-10 13:31:16 +01:00
Mark 7a3be2dd62 Refactoring: Steam engine liquid extraction
The steam engine treats barrels the same as itself when it comes to extracting liquids. This removes the need for the callback OnFuelRemoved() in the barrel, as well as the stupid definition call from the barrel to the steam engine.
2016-02-10 06:21:13 +01:00
Mark f0a1e41ac2 Failsafe barrel names 2016-02-09 18:30:50 +01:00
Mark 80fda5ae0d Fixed bug in barrel stacking and added a unit test for this use case 2016-02-09 06:43:38 +01:00
Mark c135c2da37 Use property instead of function for barrel intake 2016-02-09 06:27:42 +01:00
Maikel de Vries 159dbf071f make ContactCalls a property instead of DefCore entry
This allows for useful runtime changes, like disabling contact calls when an animal dies.
2016-02-08 21:25:43 +01:00
Mark b0153fbc51 Cleanup
Removed reference to ST-DDT in the tank library, since his code was completely removed. Moved functions in steam engine. Fixed typo in DefCore.txt
2016-02-08 20:54:26 +01:00
Mark cc113a560b Unit test for line connections 2016-02-08 17:45:32 +01:00
Sven Eberhardt 8273dcdf45 Fix cargo attachment vertex in balloon 2016-02-07 14:49:05 -05:00
Sven Eberhardt 3d3e848aeb Target balloon: Allow deployment of any items. 2016-02-07 14:27:51 -05:00
Mark b6476330d4 Barrels function as fuel now.
The steam engine does not remove the barrels, it just empties them. Made power system unit test 19 end if both pumps are pumping, this seems to be the intention of the unit test. Added power system unit test 20: Steam engine fueled by oil barrels.
2016-02-07 17:13:03 +01:00
Mark 46fceea0e0 Barrels accept oil 2016-02-07 16:03:51 +01:00
Maikel de Vries a44b759472 snap digging angle to straight lines with 5 degree margin 2016-02-07 10:24:36 +01:00
Maikel de Vries 978b236596 clean up shovel script 2016-02-07 10:24:36 +01:00
Sven Eberhardt 1e5b04e2d1 WallKit preview: Add function to update independent of position. 2016-02-06 23:53:45 -05:00
Mark ecff731d96 Changed pipe interface
- connect / disconnect callbacks do not include the line anymore
- the drain and source pipes are set to the pipe now, instead of the line
2016-02-06 23:12:26 +01:00
Sven Eberhardt 623f838799 Add sounds: Hits::BucketHit*, Structures::DoorOpen*, Structures::DoorClose* by ala 2016-02-06 14:37:18 -05:00
Mark 58650c5b6e Bugfix: Errors in UnitTest upon destruction of the pipe 2016-02-06 09:06:50 +01:00
Mark aa61a14d3d Bugfix: Message displayed above clonk, instead of connected structure 2016-02-06 08:28:02 +01:00
Mark ec6f26ddd0 Refactoring: Completely remodeled pipe interface
Pipes can connect to nearly anything now. The connecting object is responsible for rejecting the connection.
2016-02-05 23:17:31 +01:00
David Dormagen a13a9036a5 shovel: changed GetModifiedDigSpeed to GetDigSpeed
Half of the callback's work was done outside (fetching the target speed) for no good reason. It's now all done in the callback, making it less weird.
2016-02-05 21:06:30 +01:00
Mark 1603f23514 Analysis: Pipe object
The pipe object is very convoluted at the moment. Worked out some requirements for the object and will implement many things in a clean way.
2016-02-05 06:58:00 +01:00
Mark f5681434dc Refactoring: Pump interface names
The pump uses the same function names as the liquid tank now. This is a preparation for the consolidation of the two.
2016-02-05 06:22:26 +01:00
Mark 788324c077 Connection in Liquid Tank
The liquid tank can connect and deconnect lines properly now
2016-02-04 22:18:40 +01:00
Mark affb034b86 Refactoring: Pump, pipe, better menu handling
The pipe can be connected from the interaction menu now, too. Expanded the disconnection logic, because more problems arise when the pipe can still be connected to other structures - it would be sufficient to remove the line, but that could be annoying:
- if the pipe is connected to a container, then you can disconnect the pipe from that liquid tank and it will still be connected to the pump
- if you disconnect the pipe from the pump, then it will disconnect from the liquid tank as well

Maybe this is confusing to the user, we can still kick that out later again.
2016-02-04 21:37:33 +01:00
Mark 016922fa2c Refactoring: Pimp, Pipe, SteamEngine
Now it is possible to connect lines from a pump to the steam engine. This is achieved by the steam engine being a liquid tank. It did not seem good to allow connection from pumps to all liquid containers (i.e. barrels). A liquid tank is also a liquid container, they share the same interface, but it is also a structure.

It is not yet possible to fill the steam engine with any liquid though, because it is not defined what kind of liquid it accepts. This will be oil in the future. Furthermore, the behaviour when the pump adds incompatible liquid is not defined yet.
2016-02-04 18:25:19 +01:00
Maikel de Vries 879048c366 show projectile trajectory preview for the grenade launcher 2016-02-03 19:49:23 +01:00
David Dormagen 76ac759533 shovel: fix the Destruction functionality
Previously, it was checked incorrectly whether the action was "Dig". Then the check was thrown out completely in https://git.openclonk.org/openclonk.git/commit/39e86474fccbd54eb357175d2b8fbec5c60639ab - which did remove the warning but not solve the defect.
This should be a proper fix. The shovel only does stuff when the user is digging AND actually using this very shovel for it.
2016-02-01 20:15:01 +01:00
Mark 8c883937d4 Refactoring: Renamed Set/GetLiquidName to Set/GetLiquidType 2016-02-01 06:39:21 +01:00
Mark dbf1f0326f Refactoring: Barrel fill with liquid
The function had some crazy checks and delegation, now everything is in one function
2016-02-01 06:28:17 +01:00
Mark 9ee44b39ed Refactoring: Removed old barrel functions
Replaced old barrel functions with the liquid container library calls
2016-02-01 06:28:09 +01:00
Mark 64f7b4152e Library: Liquid Container
Added unit test.
2016-02-01 06:27:35 +01:00
Mark f810f210be Library: Liquid Container
Added a new library for liquid containers that is based on the original barrel script.

Library_LiquidContainer
- Extracted the interface from the barrel. The function names and argument types are not final yet.
- Fixed an inconsistency in the script: There were two ways of determining whether a barrel is suited
   for a material. Either by name, or material index.
- renamed argument names to "liquid_name" for liquids, "amount" for quantities, so that the code is more easily understandable
- replaced comparison 'fill level > 0' with 'is not empty?'
- moved storage variables to a local proplist, so that names do not clash
- Ordered the methods by application and documented each section

Barrel:
- The original barrel functions delegate to Library_LiquidContainer-functions now, so that the original functionality is not disturbed. Obsolete functions are marked with "TODO: deprecated".
- Moved barrel value change to the update function
- Moved hit sound effect to separate function
- Replaced uses of the magic number '3' with a runtime-overloadable call to GetBarrelIntakeY()
- Replaced comparison 'fill level > 0' with 'is not empty?'

MetalBarrel:
- Adjusted the hit function. The difference between this and the normal barrel is the hit sound and material position. These should be constants or functions, instead of magic numbers
- Moved hit sound effect to separate function
- Removed the Hit()-function, because the hit sound is played in a separate function now
- With this change the y-offset of the barrel checking for other liquids on a hit is now 3 instead of 7. This should be ok, because the barrels have the same dimensions, it seemed strange that they would have different offsets
2016-02-01 06:23:44 +01:00
Maikel de Vries a390f8f248 fuse and activate iron bomb on cannon shot, fuse dynamite as well 2016-02-01 00:10:23 +01:00
Maikel de Vries 39e86474fc fix wrong use of GetAction in shovel 2016-01-31 22:40:40 +01:00
Maikel de Vries 273c574dc0 shovel: symmetrize dig angle limits 2016-01-31 09:59:41 +01:00
Sven Eberhardt 1bb78ecd4f Remove some unnecessery animation weights.
These overwrite the animations in their slots while there are no other references to existing animations in the slot.
2016-01-28 23:47:53 -05:00
Sven Eberhardt 920ae9673f Fix animation leaks in bat, chest, grapple bow and tele glove #1647 2016-01-28 23:46:22 -05:00
Sven Eberhardt 380b6df2ac Make GetModifiedDigSpeed runtime-overloadable 2016-01-28 00:37:25 -05:00
Mark 41f00c6c17 Dig speed refactoring
Extracted the dig speed modification part to a separate function, so that other scenarios can easily overload this. Setting the value to 75% of the input speed provided a good handling in my tests. This is not included in this commit, feel free to experiment with it first.
2016-01-28 06:28:04 +01:00
Maikel de Vries ef1d7227f6 release rider from balloon earlier when deflating
This allows for a smoother transition into walking and scaling and leads to less annoying and unexpected deaths.
2016-01-26 23:02:32 +01:00
Maikel de Vries 488201181b improve collision detection of deployed balloon with the landscape 2016-01-24 20:36:17 +01:00
Maikel de Vries d1d019ab09 improve the hitbox of the balloon for projectile targets
This prevents the one hanging on the balloon from shooting himself down with e.g. a bow.
2016-01-24 20:36:17 +01:00
Maikel de Vries 84218d1cbc merge UsageHelp into Description
This is better for the new interaction menu, since only the description is shown for items, but it can be longer now.
2016-01-23 16:28:02 +01:00
Maikel de Vries 686b37660d fix script errors for wrong parameter types in tele glove 2016-01-22 00:14:59 +01:00
Sven Eberhardt 2ce3daf84a Add missing sound for snapping line #1644
Sound original from CosmicEmbers (http://freesound.org/people/CosmicEmbers/sounds/161650/); cropped and pitch adjusted.
2016-01-20 21:24:05 -05:00
Sven Eberhardt 729712fa2f Allow use of bucket, pickaxe, bow, club, grenade launcher, javelin and musket during scale/hangle.
Temporarily disables scale/hangle during usage of these items.
2016-01-17 14:31:51 -05:00
Maikel de Vries 7ca450b6b2 fix script errors for wrong parameter types in iron bomb effects 2016-01-17 12:51:04 +01:00
David Dormagen 368eb698ec pickaxe: removed debug message
introduced in https://git.openclonk.org/openclonk.git/commitdiff/796aa7d7c62c5348417d584c9637da61297736d4
2016-01-17 08:11:17 +01:00
Sven Eberhardt 0b6e2015cf Fix shovel shoveling in the wrong direction sometimes #1626 2016-01-16 22:02:32 -05:00
Sven Eberhardt 796aa7d7c6 Fix pickaxe picking in the wrong direction sometimes #1626 2016-01-16 22:02:08 -05:00