Commit Graph

547 Commits (master)

Author SHA1 Message Date
Mark 631c239717 Merge function for proplists 2017-05-10 22:03:57 +02:00
Mark 03dc2cb84f Some common assertions
An attempt in reducing duplicate code :)
2017-05-10 21:52:54 +02:00
Sven Eberhardt 1b4fd9abe3 Editor: Add translation overview table (Tools menu) 2017-05-09 22:43:56 -04:00
Sven Eberhardt 4fac960cf4 Editor: Add localized string support 2017-05-07 14:26:30 -04:00
Maikel de Vries c64e9b3814 scenario saving: fix position after movement by setting con and rotating 2017-03-27 09:44:28 +02:00
Maikel de Vries ae31a1fa96 fix SetVelocity script function for zero angle or speed 2017-03-06 18:52:04 +01:00
Sven Eberhardt 6184231cdc Improve default template map 2017-03-05 13:00:00 -05:00
Lukas Werling 47a419f412 Add SCENPAR to statistics if set 2017-02-21 21:19:00 +01:00
Lukas Werling 87ee44964c Send script-defined statistics to the masterserver
After GameOver(), the global function CollectStatistics() is called
which in turn calls CollectStats() on all definitions and the Scenario.
The results are collected into a proplist and sent to the masterserver
as JSON.

The intended purpose is to collect statistics like weapon kill counts
and evaluate them across all online games to improve balancing.
2017-02-17 23:29:16 +01:00
Sven Eberhardt da4f49d7ca Add AI attack mode (weapon) to editor properties 2017-02-14 01:36:12 -05:00
Maikel de Vries 60f3e206cc fix variable shadowing in some scripts 2017-02-13 19:04:27 +01:00
Sven Eberhardt ef5626774d Add another default scenario template 2017-02-05 16:08:30 -05:00
Sven Eberhardt 22306bd266 Editor: Add templates for new scenarios 2017-02-05 16:08:29 -05:00
Sven Eberhardt 2f44b48e7d Fix German string table entry for map size in new scenario dialogue 2017-02-05 16:08:29 -05:00
Lukas Werling 6c7d8b7bbb Clarify discovery error message 2017-01-09 20:35:04 +01:00
Nicolas Hake 102047f537 Implement IPv6 support to C4NetIO 2017-01-09 20:34:43 +01:00
Maikel de Vries 59961f3a17 remove base library
* remove library itself
* remove GetBase()
* change flagpole, etc.
* move basematerial library to vendor
2016-12-28 18:19:10 +01:00
Sven Eberhardt ad2a0a8955 Save scenario: Ignore objects contained in ignored objects
E.g. do not save tools carried by crew.
2016-12-28 08:53:58 -04:00
Lukas Werling f9305a1526 Editor: Fix crash when trying to save scenario into itself 2016-12-19 23:14:49 +01:00
Sven Eberhardt 1cde52e060 Editor: Add "Export packed" file menu item 2016-11-20 22:43:44 -05:00
Sven Eberhardt 04b5f82080 Editor: Add "open in network" to file menu and to new scenario dialogue 2016-11-20 13:24:09 -05:00
Mark f2870dfa16 Object.c: New functions
Needed AddSpeed() in a project and thought that it would be a good addition. AddVelocity() is not used so far, maybe we should remove it again.
2016-11-19 19:05:27 +01:00
David Dormagen 83435a89fa Fixed typo in German localization (#1848) 2016-11-11 18:20:59 +01:00
Sven Eberhardt 342916a1ed Fix some implicit for loop declaration errors 2016-10-24 21:02:02 -04:00
Sven Eberhardt 15d850e4ec Editor: Add effects to property viewer 2016-10-14 10:50:17 -04:00
Maikel de Vries 89be9bd158 implement scenario saving for liquid tank, pump & pipe 2016-10-03 18:07:49 +02:00
Sven Eberhardt d48dbfba82 Add optional size parameter to Particles_Flash 2016-10-02 23:47:01 -04:00
Lukas Werling 10622a9b61 Add generic A* implementation for path finding in graphs 2016-09-26 16:30:47 +02:00
Maikel de Vries 0e76c85531 make line overlap check a global function
This avoids code duplication and really is a Math.c function.
2016-09-24 17:30:19 +02:00
Maikel de Vries 823b13d764 add simple string to integer conversion function
Just a basic one in C4Script for now.
2016-09-18 11:30:35 +02:00
Lukas Werling db12ed7c99 Remove FindSubstring as it's really really slow
Use RegexSearch() instead, which is 100 times faster for large strings
(see benchmark results below).

Example benchmark:

    global func TestFindSubstring(int iterations)
    {
    	var result;
    	for (var i = 0; i < iterations; i++)
    	{
    		result = FindSubstring(hamlet, "and");
    	}
    	return result;
    }

    global func TestRegexSearch(int iterations)
    {
    	var result;
    	for (var i = 0; i < iterations; i++)
    	{
    		result = RegexSearch(hamlet, "and");
    	}
    	return result;
    }

    global func RunBenchmark(int iterations)
    {
    	StartScriptProfiler();
    	Log("FindSubstring: %d iterations", iterations);
    	var substr = TestFindSubstring(iterations);
    	Log("RegexSearch: %d iterations", iterations);
    	var regex = TestRegexSearch(iterations);
    	StopScriptProfiler();

    	if (!DeepEqual(regex, substr))
    		Log("Results differ: %v vs %v", substr, regex);
    }

Results:

    FindSubstring: 100 iterations
    RegexSearch: 100 iterations
    Profiler statistics:
    ==============================
    48903ms      Global.FindSubstring
    48903ms      Global.TestFindSubstring
    47979ms      Global.TakeString
    00504ms      Global.TestRegexSearch
    00016ms      Global.PushBack
    ==============================
2016-09-17 20:08:43 +02:00
Maikel de Vries 4b54b86d30 add function to find substrings 2016-09-16 17:25:22 +02:00
Sven Eberhardt 61b1ab08ad Editor: More shortcuts; show helper shortcuts in tools menu 2016-09-10 01:17:40 -04:00
Sven Eberhardt 53b365a6d2 Editor: Add shortcuts, menu items, tooltips 2016-09-08 01:56:01 -04:00
Sven Eberhardt b95d1387a4 Editor: Add "reset to saved scenario" command 2016-09-07 01:53:54 -04:00
Maikel de Vries 17f98bd235 add helper functions chars 2016-09-06 17:06:05 +02:00
Sven Eberhardt 117ddac8b4 Auto-unstick animals and objects on ground in saved scenarios 2016-09-05 01:59:59 -04:00
Sven Eberhardt 31ead2507a Add Unstick() script function
Also add a position parameter to Stuck() script function.
2016-09-05 01:59:58 -04:00
David Dormagen 4dd9be0e46 chippies: fix unintended growth through animal library
Inclusion of the library buffed the damage wild chippies do by 100%. This is unintended. Chippies grow (and get stronger) through sucking blood.
A commit that changes this behavior should address this directly. (This commit also makes chippies gain size a bit faster - as a compromise.)

The additional check in StartGrowth reduces overhead in the animals (and possibly plants) library. It is kept in this commit to give reviewers an example case for the check.
2016-09-02 09:34:19 +02:00
Sven Eberhardt b763982f45 Fix scenario saving as network client to not delete saved scenario after game end (#1814) 2016-08-28 00:56:15 -04:00
Sven Eberhardt 44022f840f Add CustomInitializationScript to all objects 2016-08-25 00:18:11 -04:00
Sven Eberhardt 4ce96cb892 Fix scenario saving of names when no name is assigned.
It created SetName("") entries because def->GetName() has a fallback to the internal name while obj->GetName() does not.

Just use .Name instead. Objects with custom naming (overloaded GetName()) need to overload name saving anyway.
2016-08-23 02:07:54 -04:00
Sven Eberhardt 4df8679be2 Simplify saving of scenario properties in saved scenarios.
Just need to set "Save" to an identifier now.
2016-08-20 01:55:21 -04:00
Sven Eberhardt bce903ee04 Merge branch 'master' into qteditor
Conflicts:
	planet/Objects.ocd/Items.ocd/Tools.ocd/Dynamite.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Animal.ocd/CreatureControl.ocd/DefCore.txt
2016-08-13 23:42:59 -04:00
Sven Eberhardt 4869eff787 Allow joining to editor games through startup network dialogue 2016-08-10 19:35:39 -04:00
Lukas Werling f3b2ff1295 Merge branch 'gamepad-controls' 2016-08-07 18:10:24 +02:00
David Dormagen a9b1b975d3 removed Libraries/Animal/CreatureControl (and thus the automatic script player)
The script players was not treated correctly by the goals, so joining it automatically would break stuff. While I still like the implications of an automatic script player, it was too much of a hassle for now.
Find_AnimalHostile works around the main issue as it allows just using Find_AnimalHostile and automatically have the animal work for both neutral owners and as pets. It does not allow for the distinction of hostile neutral and friendly neutral, though.
2016-08-07 17:05:53 +02:00
Lukas Werling 00ee209eca Hot Ice: Handicap teams with more players
In every team, the same number of players will now load their grenade
launcher before the round starts. If there's a team with more players,
some players won't be able to shoot immediately.
2016-08-07 13:56:04 +02:00
Sven Eberhardt 5db45c0f47 Merge branch 'master' into qteditor 2016-08-06 21:45:19 -04:00
Sven Eberhardt 5bb204d69b Qt editor: Fix net menu
It didn't work, had the wrong labels and crashed.
2016-08-06 21:12:04 -04:00
Sven Eberhardt e39b314239 Add property to auto-save EditorProps in scenarios 2016-08-06 14:49:48 -04:00
Sven Eberhardt fc24969899 Add EditorPlacementLimit property
Limits the number of object instances that can be placed of a given def.
2016-08-06 02:36:53 -04:00
Sven Eberhardt 9bcef15b99 Add AddScenarioSaveDependency for scenario saving: Adds a dependency without forcing a name 2016-08-05 00:30:43 -04:00
Clonkonaut 89be1da072 Changed quick switch slot selection to Number + Q.
As suggested by Zapper in this posting: http://forum.openclonk.org/topic_show.pl?pid=31073#pid31073.
This way is probably the only way item usage will ever work on Q. For now, this reverses the previous changes. Q will again react on key down.
2016-08-02 17:49:34 +02:00
Clonkonaut faf3add7e7 Quick Switch slot is now selectable using Q + number key.
This makes a very fundamental change with quick switch: The switching action is now performed on the key release instead of the key press. Let's see if this performs badly for players.
2016-08-02 00:37:40 +02:00
Sven Eberhardt 11b317808f Qt Editor: Add toggle help button to "?" menu 2016-07-25 21:39:35 -04:00
Sven Eberhardt 35a5df6c9b Revert accidental commit from master merge 2016-07-25 01:08:49 -04:00
Sven Eberhardt 534e4cc745 Merge branch 'master' into qteditor
Conflicts:
	src/script/C4AulParse.cpp
2016-07-24 10:23:57 -04:00
Sven Eberhardt 4245f60e83 Qt Editor: Add help/description label for current selection 2016-07-24 10:12:38 -04:00
Sven Eberhardt 8d6a7058c6 Fix possible user action sequence id conflict when saving scenario after testing a sequence 2016-07-13 17:39:36 -04:00
Sven Eberhardt 22328365fa Escape \ and " characters when scenario saving names and strings within proplists 2016-07-13 02:13:23 -04:00
Sven Eberhardt 279d89393c SaveScenario: Correctly save object pointers within proplist 2016-07-13 01:45:29 -04:00
Sven Eberhardt 63c9bd78e7 Qt Editor: Fix crash and prop list/array display problems when switching prop lists.
Storing the pointer in QModelIndex could sometimes keep invalid memory on the persistent model indices. Because re-organizing these memory locations would be a nightmare and we only go two levels deep anyway, just store the parent index in the internal pointer and look up the actual property on the fly.
2016-07-05 22:53:41 -04:00
Sven Eberhardt a7aa89f168 Merge branch 'master' into qteditor
Conflicts:
	planet/Objects.ocd/Structures.ocd/StoneDoor.ocd/SpinWheel.ocd/Script.c
	src/platform/C4WindowSDL.cpp
	src/script/C4AulParse.cpp
	src/script/C4Effect.cpp
2016-06-20 22:27:03 -04:00
Sven Eberhardt 44d94d5043 Improve editor duplicate function to duplicate properties and object connections.
It serializes objects using a selective SaveScenarioObjects script callback and then just executes the generated script. This automatically saves important properties, connects switches and doors, etc.

This change also solves the problem that duplicating an elevator plus case would create two elevator cases.

If execution fails (e.g. because of script errors or because a non-saveable object was duplicated), the method falls back to the legacy duplication method of creating objects with the same prototypes at the same position.
2016-06-20 01:45:26 -04:00
Sven Eberhardt e7be7d6acd Qt Editor: Add viewport context menu 2016-06-19 22:45:12 -04:00
Sven Eberhardt 25fa57cabf Qt Editor: Add "Static Flat" landscape mode 2016-06-17 18:44:59 -04:00
Sven Eberhardt 2f22a3a8fe Qt Editor: Add property delegate type "object" 2016-06-16 14:59:04 -04:00
Sven Eberhardt 16e31098b4 Qt Editor: Improve proplist and array display/editing
* Add/Remove element buttons
* Display customization of user delegates
2016-06-06 01:54:05 -04:00
Maikel de Vries 695680cb6c objects on fire inflame inflammable materials 2016-06-03 22:08:14 +02:00
Sven Eberhardt b10da0629d Qt Editor: More EditorProps types (string, array) and attributes (EditOnSelection, DefaultEditorProp) 2016-06-03 01:20:43 -04:00
Sven Eberhardt af2a74b6ec Qt Editor: Array editing 2016-05-28 09:30:54 -04:00
David Dormagen 2df2946016 OnInIncendiaryMaterial: check for object removal after energy loss 2016-05-27 22:19:41 +02:00
Sven Eberhardt d304b17028 Qt Editor: Editing of child proplists 2016-05-24 23:06:00 -04:00
Maikel de Vries 3455fa24f9 add some variation to the maximum size of trees 2016-05-21 13:34:34 +02:00
Maikel de Vries 18f2b4831a add max size option to StartGrowth 2016-05-21 13:34:34 +02:00
Maikel de Vries 6c8c4c9c19 allow more components than def for Oversize objects 2016-05-21 13:34:34 +02:00
Maikel de Vries 2a731b2545 implement Components as a property lookup table 2016-05-21 13:34:34 +02:00
Maikel de Vries 62ad9eb53b reimplement components scaling with object completion 2016-05-21 13:34:34 +02:00
Maikel de Vries a81ccaab22 add function to make properties writable
Thanks to Guenther for the implementation details, documentation will follow when it is considered a stable solution.
2016-05-21 13:34:34 +02:00
Maikel de Vries 4833f839d2 script implementation of GetComponent and SetComponent
This allows to remove the engine functionality and is based on the property Components = [[def1, amount1], [def2, amount2], ...]. Follow up commits will remove the engine functionality.
2016-05-21 13:34:33 +02:00
Maikel de Vries accd897b91 rename NoComponentMass to NoMassFromContents
This had nothing to with components, and risk of backwards compatibility is minor.
2016-05-21 13:34:33 +02:00
Maikel de Vries 183ab4c4a0 remove unused function ComposeContents 2016-05-21 13:34:33 +02:00
Maikel de Vries 5841b55f7e remove unused function GetNeededMatStr 2016-05-21 13:34:33 +02:00
Günther Brammer d23ffde361 Merge script branch 2016-05-15 19:21:26 +02:00
Günther Brammer ef515cc3c7 Script: Prototypes for CreateEffect should inherit from Effect
This makes the special effect properties useable without the "this." prefix,
makes the various useful global functions available as well as
effect-specific functions.
2016-05-15 15:22:42 +02:00
Nicolas Hake 8e18a3fc96 Change (int)0 to nil where deprecated 2016-05-13 17:13:34 +02:00
Lukas Werling 9fa16c5e14 SDL: Enable multisampling
Unfortunately, there doesn't seem to be an easy way to apply
multisampling changes in SDL. As a workaround, a message requesting the
player to restart the game is shown.
2016-05-07 12:25:11 +02:00
Lukas Werling c9aa07ee60 Add more documentation for Mod() (#1735) 2016-05-01 19:52:22 +02:00
Lukas Werling dd48a759d7 Add mathematical modulo helper function Mod(a, b) 2016-05-01 19:25:12 +02:00
Maikel de Vries f4ae76454b rename player control callback for specified id's to silence warning
It is better to have different names for different callbacks.
2016-04-29 21:51:58 +02:00
Günther Brammer b00b8554ab Merge branch script 2016-04-28 03:25:44 +02:00
Maikel de Vries 92334f5f4c take into account container velocity in shockwaves
This ensures reliable flint jumping when using dynamite, ironbomb, powderkeg, etc.
2016-04-24 20:33:44 +02:00
Günther Brammer c167e990a5 Add GetName function to Actions 2016-04-24 19:40:29 +02:00
Sven Eberhardt 4e7df72c4c Editor Props: Invincibility and player color. 2016-04-16 22:05:38 -04:00
Sven Eberhardt c0228be4e7 Qt Editor: More editor property types and functionality 2016-04-16 22:05:35 -04:00
Maikel de Vries 100b87af1a add leaf particle 2016-04-12 23:53:46 +02:00
Nicolas Hake 9dddf289db Merge branch 'master' into qteditor 2016-04-03 21:06:32 +02:00
Sven Eberhardt dc7259bb1e Qt Editor: Allow opening of user path from welcome page 2016-03-26 14:02:40 -04:00
Sven Eberhardt b3712ace97 qt editor: Add "Editor" button to startup main menu 2016-03-26 02:15:15 -04:00