Commit Graph

5057 Commits (692b8a9cc52a1b476cd2a5bae9598c7dcdaa52ed)

Author SHA1 Message Date
Mark 1d8163e3f2 Producers: Unit tests for fuel objects 2016-03-18 17:18:33 +01:00
Mark 2e3a984b20 Producers: Fixed objects with liquid need
Liquids are handled as objects now, so that the function GetLiquidNeed() in the objects is obsolete. Adjusted the collection function accordingly.
2016-03-18 06:35:44 +01:00
Mark a224d62791 Stackable: Unit test for initialization
The earth object did not include _inherited(...) in the Construction() callback. Thus it was not initialized as a stackable object correctly. Fortunately the other stackable objects did not have this problem.
Nonetheless I added a unit test, so that we can identify similar problems in the future.
2016-03-18 06:30:16 +01:00
Mark 992c3cd074 Producers: Modified unit test 2016-03-17 22:43:31 +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 a24ec9f0ac Producers: Basic unit test 2016-03-17 21:51:35 +01:00
Mark 49fdd59362 Refactoring: Stackable: Moved callback CollectFromStack()
The callback happens in every call to MergeWithStacksIn() now, instead of RejectEntrance(). Otherwise the following use case does not work: Liquid enters crew/building and fills the contained barrels. Added a unit test for that use case. Stackable unit tests still pass.
2016-03-17 18:43:08 +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 8749300622 Fix unit tests: Some code adjustments were forgotten in the other commits. 2016-03-16 22:44:48 +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 e1cde6a92e Stackable: Better explanation of TryPutInto() 2016-03-16 07:00:54 +01:00
Mark 918baf3c11 Stackable: Documentation 2016-03-16 06:52:59 +01:00
Clonkonaut dc74a2301f Mooq: Fixed mesh rotation. 2016-03-14 12:07:46 +01:00
Mark 176856e276 Refactoring: Stackable: Moved HUD notifications to a separate function.
It should be OK that the new function calls OnInventoryChange() in Clonks on destruction now.
2016-03-11 17:10:41 +01:00
Mark a61eac6ff3 Refactoring: Stackable: Reenabled recursive stacking into items
This got removed by accidet (checking if the object was added to another stack seemed logical). However, this whole function does not really make sense. It returns true if the object got removed only. That means that the object would not enter the other object anyway.
Removed the UpdateStackDisplay(), because that happens in TryAddToStack() if the count changes, anyway.
2016-03-11 07:03:22 +01:00
Mark b40e44340c Stackable: Reverted some tests.
Checked the tests against the original implementation. Turns out that the implementation was recursive for finite stacks after all!
2016-03-10 17:41:22 +01:00
Mark 0759c59bf1 Stackable: Fixed remaining unit tests 2016-03-10 17:29:42 +01:00
Mark 2e8ed77f56 Stackable: Fixed unit test 17
The test simply had a wrong expectation.
2016-03-10 17:20:45 +01:00
Mark 862c4ad312 Stackable: Fixed unit test 12 and 13
The test expects what the method does. Added original expected behavior in comments, because this was the use case example.
2016-03-10 07:03:29 +01:00
Mark f0aa3fafc7 Stackable: Fix unit test 8
The test now expects what the functions actually do. Put the previously expected behavior in comments
2016-03-10 06:56:05 +01:00
Mark 674145dc48 Refactoring: Stackable: Fix unit test 5
Added documentation for Stack(); Stack() does not stack on top of itself anymore.
2016-03-10 06:41:34 +01:00
Mark 969469190e Refactoring: Stackable: Replaced 'count' with GetStackCount()
This is possible, because the function returns the actual count now.
2016-03-10 06:25:04 +01:00
Mark 25408b4367 Refactoring: Stackable: Simplified TakeObject() even further
The check whether the stack is infinite happens in DoStackCount(), too.
2016-03-10 06:17:07 +01:00
Mark ea3c5ad920 Refactoring: Stackable: Simplified TakeObject()
The part where the stack count is reduced behaves the same as DoStackCount(); The stack display is updated in SetStackCount()/DoStackCount() respectively, so that line can be removed.
2016-03-10 06:14:49 +01:00
Mark 556454fcf4 Stackable: Fix unit test 14
The function IsInfiniteStackCount() now returns an actual boolean value, instead of nil.
2016-03-10 06:11:14 +01:00
Maikel de Vries d0ee605728 Merge branch 'hotice-rounds' 2016-03-09 21:47:44 +01:00
Lukas Werling 2236d4fa4a Hot Ice: Allow scrolling while waiting for the next round 2016-03-09 21:29:42 +01:00
Lukas Werling 3b039f8342 Hot Ice: Add scoreboard 2016-03-09 21:08:14 +01:00
Maikel de Vries 21c5f63d44 wipf: dig free is covered with earth (#1703) 2016-03-09 20:54:43 +01:00
Mark 76a0860a68 Refactoring: Stackable: Infinite stacks are not removed when taking the whole stack
Also made IsInfiniteStackCount() runtime-overloadable
2016-03-09 16:39:30 +01:00
Mark 114ad2697e Refactoring: Stackable: A stack can never contain 0 items
Stacks with 0 or less items are always removed. GetStackCount() returns the actual stack count now, which should always be positive.
2016-03-09 06:59:46 +01:00
Mark 0ea8894dbd Comment out logging in stackable 2016-03-09 06:32:12 +01:00
Mark b16e94d51d Stackable: Unit test for use case #2 with infinite objects 2016-03-09 06:30:49 +01:00
Lukas Werling d2836bb70a Hot Ice: Add option for multiple rounds 2016-03-09 00:32:02 +01:00
Mark 2dd6bbdaf4 Stackable: More unit tests for infinite object 2016-03-08 22:53:27 +01:00
Mark 350088525c Refactoring: Stackable: Use InitialStackCount() where it makes sense 2016-03-08 06:57:53 +01:00
Mark d8a68f5655 Stackable: Unit test for stacking finite and infinite objects 2016-03-08 06:48:34 +01:00
Mark dc84a1a5e2 Refactoring: Stackable: IsInfiniteStackCount() instead of count_is_infinite
The interface should be used instead of the internal variable, in case something gets renamed.
2016-03-07 17:49:11 +01:00
Mark fe5e1bc581 Stackable: Unit test for infinite stack count, basics.
Found a bug: An infinite stack gets removed if you take the entire stack at once.
2016-03-07 17:47:49 +01:00
Mark 45fbc64254 Stackable: Remove obsolete objects. 2016-03-07 06:53:08 +01:00
Mark c7fc982d3e Stackable: Unit tests for the use cases from the stackable documentation. 2016-03-07 06:40:27 +01:00
Mark 8573ed9745 Stackable: Unit test for deeply nested extra-slot objects 2016-03-07 06:13:44 +01:00
Mark df04c2c9c1 Stackable: Unit test 9
Stack objects into a container with non-extra-slot containers.
2016-03-06 21:44:57 +01:00
Mark 4101dc7600 Stackable: Additional test scenarios for unit test 8 2016-03-06 21:30:57 +01:00
Mark d86fe2549d Stackable: Unit test for TryPutInto() with empty containers.
First part of a series of tests. TryPutInto() has to be tested with several container types.
2016-03-06 21:04:28 +01:00
Maikel de Vries 21cbf97562 fix contact calls and borderbound for mooq 2016-03-06 10:45:02 +01:00
Maikel de Vries d768e9e256 fix playing mooq sounds and move sounds to Sound.ocg 2016-03-06 10:37:29 +01:00
Mark e92f5b6bf9 Stackable: Better logging in unit test
Also corrected some minor details in the test logic, related to InitialStackCount() and MaxStackCount().
2016-03-06 06:49:57 +01:00
Clonkonaut 5801a2f133 Mooq: Applied Script Guidelines. 2016-03-05 19:02:27 +01:00
jok21 0f1b9c0891 Mooq Particle Change 2016-03-05 19:02:26 +01:00
jok21 a89ee8e51b MooqSounds 2016-03-05 19:02:25 +01:00
jok21 4c4a590ac8 Mooq 2016-03-05 19:02:23 +01:00
Maikel de Vries 9b39f2b18c fix ShuffleArray
When taking a random element from the copy, also consider the last element.
2016-03-05 17:27:20 +01:00
Maikel de Vries 1862161708 eject structure contents on destruction 2016-03-05 16:40:33 +01:00
Mark 258f3d3b3b Stackable: Unit tests for Stack() and TryAddToStack() 2016-03-04 17:46:24 +01:00
David Dormagen 4465236d1b interaction menu: added contents count to "Inventory" (#1697)
..I am open to discuss the exact design of this.
2016-03-04 08:18:20 +01:00
Mark ec35a11013 Stackable: More unit tests
Tests for CalcValue() and TakeObject(). Testing the behaviour in combination with containers that have an extra slot is necessary.
2016-03-04 06:57:47 +01:00
Mark e8b6fda751 Stackable: Unit test
First unit tests for the stackable library
2016-03-03 23:01:52 +01:00
Mark a785ca83da Stackable: Added InitialStackCount()
For things such as the liquid object that starts with 1 item in the stack, so that the Construction() function does not have to be overloaded.
2016-03-03 22:13:27 +01:00
Mark 96e59a0626 Failed attempt at unit test nr. 6 2016-03-03 22:10:10 +01:00
Mark 3c05d53b3a Liquid objects: Added unit test 5 2016-03-03 17:20:58 +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 cbe8bbd8e8 Removed authors Ringwaul and ST-DDT from liquid container
They were not involved in the current script
2016-03-03 17:07:37 +01:00
David Dormagen c6dd261d05 Surrounding helper: added ContentsCount overload
..which is a pre-requisite to showing the current / max. contents count in the interaction menu.
2016-03-03 10:46:11 +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 afc8797b2f Fix steam engine 2016-03-01 19:54:55 +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 4f19651f0e Removed liquid need objects 2016-03-01 06:58:16 +01:00
Mark 4f51a75a20 Removed fuel object
Need for a fuel burner library is evident
2016-03-01 06:55:02 +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 7561779d8c Producers handle fuel and liquid with liquid objects 2016-02-27 15:04:37 +01:00
Mark a524e7db2c Added comment 2016-02-27 14:43:24 +01:00
Mark 0a77b58b6a Steam Engine: Use fuel as liquid, finished
The pump was blocked, because the steam engine did not insert enough material
2016-02-27 14:35:38 +01:00
Mark 7a1b7d6258 Merge 'master' into liquid_container 2016-02-27 12:51:11 +01:00
Mark 7894fb0fc6 Steam Engine: Use fuel liquid, Work in progress 2016-02-27 12:41:46 +01:00
Mark 8f7d823633 Steam Engine: Replace fuel_amount with GetFuelAmount() where possible 2016-02-26 23:30:17 +01:00
Mark 52884fb685 Removed liquid container logic from pump.
Previously, sharing the logic made sense, because both objects used variables to store the liquid. Now, the liquid container stores liquid in an object - this is not desirable in the pump because it would create and remove objects for no good reason (only so that it has a virtual liquid storage) every time it pumps. Consequently, liquid objects cannot enter a pump anymore.
2016-02-26 23:17:38 +01:00
Mark fa0af84686 Fixed pump 2016-02-26 23:03:52 +01:00
Mark 351e61832c Liquid Container: Fixed liquid objects remaining in existence after test. 2016-02-26 22:38:38 +01:00
Mark af8e681ec8 Liquid Container: Let liquid object handle removing liquids 2016-02-26 22:11:11 +01:00
Mark 8a49ae10c0 Liquid Container: Removed logging 2016-02-26 22:06:04 +01:00
Mark 1acdfd4c1a Liquid object: Fixed unit test 3 2016-02-26 21:56:52 +01:00
Mark 55401f88e3 Liquid object: Fixed unit test 12
Added test for filling an empty barrel partially
2016-02-26 15:42:54 +01:00
Mark 79df36eb6b Liquid object: Refactored object entering system.
Unit test 3 still fails, because the functions are not runtime overloadable. Test 12 fails, because liquid transfer does not work correctly yet. This fill be fixed in the next checkin.

Added debug logging, this has to be removed again later.
2016-02-26 15:19:41 +01:00
Sven Eberhardt 65d6dd76a3 Meltign Castle: Fix item spawn after 4 minutes; add restart rule. 2016-02-21 17:36:29 -05:00
Sven Eberhardt 5963b9aed3 ItemSpawn: Add reset function to enable re-collection of item. 2016-02-21 16:56:19 -05:00
Sven Eberhardt e87ad1ecc1 MeltingCastle: Rebalance for slightly less rushing. 2016-02-21 16:31:20 -05:00
Lukas Werling 9f69c650d6 Use icons for all controller buttons
The icons currently only show Xbox 360 controller labeling. The icon set
also includes icons for PlayStation controllers, so we could extend this
in the future.
2016-02-21 18:27:02 +01:00
Lukas Werling aa42d1deb7 Make controller button strings nicer
This also removes the controller id from the control definitions,
instead defaulting to 0. This doesn't change anything for now as we only
had definitions for controller 0 anyways.
2016-02-21 18:27:01 +01:00
Lukas Werling 8dd1450e94 Implement "gamepad stick moved" events for analog input
Analog moved events are only sent once per control frame.
2016-02-21 18:26:18 +01:00
Mark af6a31c489 Merge remote-tracking branch 'master' into liquid_container 2016-02-20 21:17:59 +01:00
Mark 862e69655e Liquid object: Test for liquid leaving the container 2016-02-20 21:10:41 +01:00
Mark 7cc88bd909 Liquid Object: Simplified transfer into liquid container.
Unfortunately, now the object is not actually transferred, but removed, and a new one is created or an existing one is filled in the liquid container. The logic could use a rework actually, because everything was more clear when the container stored things in variables.
2016-02-20 21:00:48 +01:00
Mark 9e46d752a9 Liquid Object: Unit test for entering liquid containers
The tests handles the entrance of liquid objects into the container. Will look to simplify the script in the next commit.
2016-02-20 20:14:19 +01:00
David Dormagen 63655f2763 global func Decay: some cleanups & added 'delay' parameter for decay speed 2016-02-20 17:57:55 +01:00
Mark d0cf26490e Removed unused function from erroneous merge 2016-02-20 17:31:26 +01:00
Armin Schäfer 9dca94a6b8 New Title image overlay. 2016-02-20 17:26:43 +01:00
Armin Schäfer 40016ae586 Replace old Decay methods in some animals.
# Conflicts:
#	planet/Objects.ocd/Animals.ocd/Bat.ocd/Script.c
2016-02-20 17:25:48 +01:00
Armin Schäfer 2893b22551 Add Decay function to Objects.ocg\System.ocg 2016-02-20 17:22:51 +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 46e18f5f9f kill tracing: add test for bomb arrow tumble kill 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
Maikel de Vries 9266157a1e clonk: don't play doubt sound when exit command fails 2016-02-19 22:13:09 +01:00
Mark 8698aa25cf Object Interation Menu: Request displayed amount from objects
The special handling of the stackable library was moved from the interaction menu to that library. The reasoning behind this is that the menu should not have to know each and every object, but the objects should tell the menu how they are displayed.
Liquids are displayed by their liquid count now. It would be even better, if the max. capacity would be displayed without having to hover the description field.
2016-02-19 15:19:41 +01:00
Mark 8c578931bb Liquid Object: Replaced liquid container logic
The liquid container now stores liquid objects, instead of volume and liquid type. Liquid objects can have be of a specific type, such as Liquid_Water, Liquid_Oil, etc..., but they can also just stay Library_Liquid for other liquids.
The liquid container logic has become more complex now, but still works as before. Transferring liquids to other objects may still need some improvements:
- at the moment, transferring liquids between liquid containers is possible
- maybe liquids objects, such as oil, can enter a liquid container while another liquid is in that container already - will need a unit test for that
- transferring liquid from a liquid container to a structure or crew member should be possible (but is not yet), if the target is not a liquid container but contains liquid containers
2016-02-19 06:53:44 +01:00
Mark 9a2b8449ec Liquid objects: No stackable library 2016-02-17 06:49:53 +01:00
Mark 91adb6140a Fix/merge from rebase: BarrelIntake as property 2016-02-16 21:16:32 +01:00
Mark e2689ad1c3 Prototype: Liquid objects as menu icon
It seems that real objects would be nicer.
2016-02-16 21:08:23 +01:00
Mark 1cf04d24c5 Liquid objects: Enter liquid containers only 2016-02-16 21:08:18 +01:00
Mark 9b17e41900 Liquid objects: Adjusted producer 2016-02-16 21:08:14 +01:00
Mark e39dbe48db Prototype: Liquid objects
Stackable liquid objects, as a prototype for storing liquids
2016-02-16 21:08:09 +01:00
Mark da87ac2d69 Bugfix: Called wrong function 2016-02-16 21:08:04 +01:00
Mark ae9736c18b Move liquid libraries to sub-folder LiquidControl 2016-02-16 21:08:00 +01:00
Mark 7707c7237e Producer: Liquid can be extracted from the producer itself 2016-02-16 21:07:55 +01:00
Mark 1dbb81554d Refactoring: Removed the flagpole from power system test #21 2016-02-16 21:07:50 +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 734987cd8d Steam engine: Reduced duplicate code 2016-02-16 21:07:41 +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 be8fd0833c Oil-burning steam engine
The steam engine can burn oil as fuel now. Added test to power system unit test. Still needs support for actually getting oil into the engine.
Fixed a bug in LiquidContainer that would return no liquid if the entire contents are removed. Added unit test for said bug.
Fixed overspilling of connected liquid containers. Pump no longer counts as a liquid container/tank, so that it still spills liquid if no drain is connected.
2016-02-16 21:04:06 +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 cce260a9a7 Refactoring: Steam engine
Made the steam engine interface more modular, removing duplicate code. Added a callback when refilling fuel that allows the objects not to be removed. This is important for barrels, because barrels will just empty their contents, they should not vanish!
2016-02-16 21:03:57 +01:00
Mark 07b242d6b1 Barrels accept oil 2016-02-16 21:03:52 +01:00
Mark 0c873a1950 Material: Oil
Added the material, does not burn yet, has no value in the game for now
2016-02-16 21:03:48 +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 611655a9ce Removed comments 2016-02-16 21:03:38 +01:00
Mark 2099146839 Adjusted unit test so that it works with the new interface 2016-02-16 21:03:34 +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 5c83545900 Refactoring: Replaced pump internal liquid storage with library function calls
The pump actually stores liquid until it can pump. This may not be desired, but it was like that before my changes already. This probably is better than having it drop excess material at the pump.
2016-02-16 21:03:10 +01:00
Mark 30352e422e Refactoring: Replaced pump pipe variables with library function calls 2016-02-16 21:03:06 +01:00
Mark 9c28cb978a Analysis for refactoring 2016-02-16 21:03:01 +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 e1627a2619 Pump liquids to liquid containers
The pump can transfer liquids to and from liquid containers now. Changed the material storage from material index to material name now, because liquid containers may contain fantasy liquids, too. The pipe cannot output such imaginary liquids though, so only transfer between compatible containers is possible.
2016-02-16 21:02:51 +01:00
Mark 427cacfbba Bugfix: Insert at wrong object 2016-02-16 21:02:46 +01:00
Mark 7b573691a4 Bugfix: Wrong menu entry in pump 2016-02-16 21:02:41 +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 75ebbb2851 Library: Tank
Drain and source pipes can be connected to the tank
2016-02-16 21:02:23 +01:00
Mark 94d47aa2ba Pump: Menu action constants
Replaced the hardcoded strings in the pump interaction menu with constants.
2016-02-16 21:02:18 +01:00
Mark a4058777f0 Library: Liquid Container
Added inherited-call to Construction()
2016-02-16 21:02:13 +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
Mark 35604ec1ac Pump interface:
The pump gets the interfaces ExtractMaterialFromSource and InsertMaterialAtDrain that allow for overloading the pumping process
2016-02-16 21:01:46 +01:00
David Dormagen 3227a43b17 HUD progress bar: fixed type of GUI positioning "Top" property
The method returns an int and we need a string. It's correct in all other places.
2016-02-16 19:01:03 +01:00
Mark c73993d442 Prototype: Liquid objects as menu icon
It seems that real objects would be nicer.
2016-02-16 18:41:19 +01:00
Mark bb74e69fa4 Liquid objects: Enter liquid containers only 2016-02-16 18:14:54 +01:00
Mark bd0923d057 Liquid objects: Adjusted producer 2016-02-16 18:14:32 +01:00
Mark fb627f3024 Prototype: Liquid objects
Stackable liquid objects, as a prototype for storing liquids
2016-02-16 06:57:26 +01:00
Mark 5200dcf724 Bugfix: Called wrong function 2016-02-16 06:29:01 +01:00
Mark 3481f5e830 Move liquid libraries to sub-folder LiquidControl 2016-02-16 06:16:34 +01:00
Mark 190eacb5f0 Producer: Liquid can be extracted from the producer itself 2016-02-16 06:13:38 +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
Lukas Werling 937ddaf722 Update key code strings for game controllers
With the SDL_GameController interface, buttons and axes have actual
names we can refer to. This also allows for advanced mappings using both
sticks (this probably needs script changes) as well as the triggers.
2016-02-13 23:28:00 +01:00
Sven Eberhardt a69958554f Melting Castle: Add IceWallKit spawn
To promote more waling attacks and walling defenses.
2016-02-13 10:43:42 -05:00
Mark 5224eb5b18 Goal Resource: Variable amounts of exploitation
It is possible to set the amount of resources to be extracted with an additional parameter in SetResource() now. The default amount to be extracted is 95 percent, which is the same behaviour as before the changes.
2016-02-11 22:16:19 +01:00
Mark 3993a41cea Goal Resource: Code comments
Some more fine tuning, code comments.
2016-02-11 22:04:22 +01:00
Mark 03d4662811 Goal Resource: Readability
Made the lines more readable.
2016-02-11 21:56:14 +01:00
Mark f122346241 Goal Resource: exploitable_units
Renamed mat_cnt. Will make the lines more readable in the next commit.
2016-02-11 21:50:50 +01:00
Mark 9fa4632a48 Goal Resource: ExploitableObjectCount()
Extracted the division by blast_ratio to a function. This should help again when expanding to diggable materials.
2016-02-11 21:42:19 +01:00
Mark a4d2edd0d2 Goal Resource: ObjectCount2MaterialCount()
Deciphered what some of the functions are good for, since the original code is kind of cryptic. This should help again when expanding to diggable materials.
2016-02-11 21:35:59 +01:00
Mark 50b4d6bae8 Goal Resource: AvailableObjectCount()
Replaced the ObjectCount() calls with a function. This should make it easier to expand the script to diggable materials later.
2016-02-11 21:20:13 +01:00
Mark d9e75aaaba Goal Resource: Improved variable names
Renamed indices, removed unused variables.
2016-02-11 21:06:38 +01:00
Mark 5c2dcf41a3 Goal Resource: Improved variable names
Extracted functions that were used multiple times and use consistend naming for material.
2016-02-11 21:02:16 +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
David Dormagen 77bdc8e841 disallow collection via shift when contained (#1677) 2016-02-10 18:12:09 +01:00
Lukas Werling 29491ec3b7 Replace lots of empty parameters with proplist for Sound() 2016-02-10 13:31:16 +01:00
Lukas Werling 4ca5d2bb40 Add variants of Sound(At) taking a proplist for options 2016-02-10 13:14:06 +01:00
Mark bfb3d0cc8b Refactoring: Removed the flagpole from power system test #21 2016-02-10 06:22:38 +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
Nicolas Hake 5f895c14fc Materials: Fix misspelling of "Incendiary" (#1680)
The wrong spelling will still be accepted as a material value, as long
as no value with the correct spelling exists.
2016-02-09 23:45:02 +01:00
Nicolas Hake 6f669e7b49 Merge remote-tracking branch 'github/pull/11' 2016-02-09 22:18:49 +01:00
Maikel de Vries 99d5a7c8c9 lorry: play a sound when dumping contents 2016-02-09 19:33:30 +01:00
Mark 514eae0102 Steam engine: Reduced duplicate code 2016-02-09 18:49:09 +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 47d6f2d75a disable contact calls for dead bats (#1676) 2016-02-08 21:25:43 +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
Maikel de Vries 3e5bec1ffd tutorial 7: add interaction to call the airship (#1595) 2016-02-08 17:32:30 +01:00
Maikel de Vries c4c8362ef8 tutorial 3: ensure progress if sawmill is completed in a diffent way (#1674)
for example if the pieces of rock are put into the site one by one.
2016-02-08 15:27:58 +01:00
Maikel de Vries a88a890960 tutorial 7: explain cycling through multiple interactions (#1599) 2016-02-08 15:27:58 +01:00
Maikel de Vries 0d358ce45b tutorial 4: make sure player hacks out ore at the right location (#1675) 2016-02-08 15:27:58 +01:00
Maikel de Vries 04877e33da do not test permeable solid mask on the elevator case in master
This messes up so many things as one could have expected. Instead we do the sensible thing and enable it only in the test scenario. For future reference all sequences involving an elevator and NPC clonks are broken with this feature.
2016-02-08 15:27:58 +01:00
Maikel de Vries 933314165b tutorial 2: fix confusing formulation for dropping items (#1633) 2016-02-08 15:27:58 +01:00
Maikel de Vries 8128b8db33 tutorial 2: improve message to make loam bridge (#1634) 2016-02-08 15:27:58 +01:00
David Dormagen 76f971e9d9 interaction highlight: limit highlight's Plane for objects behind the Clonk
Otherwise, a catapult might appear to shine through the Clonk. This might look odd.
For objects in front the the Clonk, the GUI-Plane is kept.
2016-02-08 12:35:42 +01:00
David Dormagen c6da7d54aa interaction highlight: create selector particle with a slight delay
Only on first selection, though.
http://forum.openclonk.org/topic_show.pl?pid=31112#pid31112
2016-02-08 12:31:54 +01:00
Mark 3e71b81e5f Oil-burning steam engine
The steam engine can burn oil as fuel now. Added test to power system unit test. Still needs support for actually getting oil into the engine.
Fixed a bug in LiquidContainer that would return no liquid if the entire contents are removed. Added unit test for said bug.
Fixed overspilling of connected liquid containers. Pump no longer counts as a liquid container/tank, so that it still spills liquid if no drain is connected.
2016-02-08 08:32:27 +01:00
Sven Eberhardt c9d3cd7417 Add MeltingCastle team melee 2016-02-07 17:21:14 -05:00
Maikel de Vries 1ebdc31182 add tutorial 6
Still intro, outro and some NPCs missing.
2016-02-07 21:29:27 +01:00
Maikel de Vries 2a4fa85583 tutorials: fix some descriptions and control strings 2016-02-07 21:29:27 +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
Sven Eberhardt 35fcc0ff51 Fix scenario saving of array-typed visibility. Fix ItemSpawn saving and spawn def re-setting. 2016-02-07 13:21:01 -05:00
Sven Eberhardt ef032c60fa ItemSpawn: Simplify script, add team-only spawns, add scenario saving and add sound on collection.
The script now just sets visibility per player (VIS_Select) instead of creating one dummy object per player. It also uses the object directly instead of indirecting everything through an effect (the effect couldn't be used on other objects anyway).
2016-02-07 12:21:13 -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
Sven Eberhardt 79897ce777 Move ItemSpawn from Aerobatics to main Objects. 2016-02-07 10:43:24 -05:00
Mark 1940791e8a Refactoring: Steam engine
Made the steam engine interface more modular, removing duplicate code. Added a callback when refilling fuel that allows the objects not to be removed. This is important for barrels, because barrels will just empty their contents, they should not vanish!
2016-02-07 16:29:15 +01:00
Mark 46fceea0e0 Barrels accept oil 2016-02-07 16:03:51 +01:00
David Dormagen 28ffc3d3b1 Library_Constructor: use normal single-use instead of holding-use
..because the library wasn't actually USING the holding callback at all. And it had/has its own CON_Aim hackery anyway. No need for the control-library internal CON_Aim stuff then (I could imagine this might just lead to issues at some point).
2016-02-07 10:47:33 +01:00
David Dormagen d9760cdab6 controls: properly set noholdingcallbacks to false when using ControlUseStart (#1327)
Otherwise the situation could arise where you used a ControlUseStart object (the wallkit) but noholdingcallbacks was still set to true (because e.g. you used a hammer before). Then you would not be able to move the preview.
This is described in a comment to the referenced bug.
2016-02-07 10:47:33 +01:00
Maikel de Vries 148b217003 jet stream: do not attempt to move stuck objects 2016-02-07 10:24:36 +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
Maikel de Vries 145b902f65 correctly handle SetDir for the catapult
Ideally the script is fully changed to correctly use dir.
2016-02-07 10:19:11 +01:00
Maikel de Vries 0a928d4a11 tutorials: various small fixes 2016-02-07 10:19:11 +01:00
Sven Eberhardt 1e5b04e2d1 WallKit preview: Add function to update independent of position. 2016-02-06 23:53:45 -05:00
Sven Eberhardt d213115103 Add function to CTF flag to disable pickup.
To be used by scenarios that use the flag differently.
2016-02-06 22:45:53 -05:00
Sven Eberhardt 775533a8da Catapult and cannon: Add functions to rotate instantly.
Useful for scenario designers.
2016-02-06 22:45:14 -05:00
Sven Eberhardt 43451a4242 HotIce: Lower spawn position on explosive mode with small islands 2016-02-06 20:40:44 -05:00
Mark 3e85cdce92 Material: Oil
Added the material, does not burn yet, has no value in the game for now
2016-02-06 23:22:00 +01: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
Mark e08e8fbb51 Removed comments 2016-02-06 22:50:43 +01:00
Sven Eberhardt 623f838799 Add sounds: Hits::BucketHit*, Structures::DoorOpen*, Structures::DoorClose* by ala 2016-02-06 14:37:18 -05:00
Mark 33c35d1de4 Adjusted unit test so that it works with the new interface 2016-02-06 09:07:18 +01: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 8378580491 Refactoring: Replaced pump internal liquid storage with library function calls
The pump actually stores liquid until it can pump. This may not be desired, but it was like that before my changes already. This probably is better than having it drop excess material at the pump.
2016-02-05 06:42:55 +01:00
Mark f02dc7cd95 Refactoring: Replaced pump pipe variables with library function calls 2016-02-05 06:34:50 +01:00
Mark 0407ad71c4 Analysis for refactoring 2016-02-05 06:31:49 +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 1ca0484f21 Pump liquids to liquid containers
The pump can transfer liquids to and from liquid containers now. Changed the material storage from material index to material name now, because liquid containers may contain fantasy liquids, too. The pipe cannot output such imaginary liquids though, so only transfer between compatible containers is possible.
2016-02-04 22:58:06 +01:00
Mark 910cf0011d Bugfix: Insert at wrong object 2016-02-04 22:23:52 +01:00
Mark 74ae56b056 Bugfix: Wrong menu entry in pump 2016-02-04 22:19:00 +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
David Dormagen 71fa846016 Zaphive: now C4D_Object + DFA_ATTACH instead of C4D_StaticBack (#1653)
Which means that you can
1) Drag around the tree / nest in editor mode
2) Shoot zapnests that were put into a catapult by a scenario designer
3) Can RemoveObject a tree and the nest will fall down (instead of keep floating)
4) Can put zap nests in earth (just like in CR!)
2016-02-04 20:07:48 +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 0ac6093b1a improvements to gem grabbers
- bats as a challenge
- less gem mining on normal
- everrock on insane
- basements for shipyard and inventors lab
2016-02-04 17:53:59 +01:00
Maikel de Vries 456678afbd add new items to worlds knowledge 2016-02-04 17:52:21 +01:00
Maikel de Vries e4095fb77b bat: placement option for tunnel only 2016-02-04 13:31:44 +01:00