diff --git a/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/Script.c b/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/Script.c index 78b8fd441..e0ecade50 100644 --- a/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/Script.c +++ b/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/Script.c @@ -132,3 +132,25 @@ protected func FxIntEarthquakeTimer(object target, effect, int time) /*-- Proplist --*/ local Name = "$Name$"; + + +/* Editor */ + +public func Definition(def, ...) +{ + UserAction->AddEvaluator("Action", "Disasters", "$LaunchEarthquake$", "$LaunchEarthquakeHelp$", "launch_earthquake", [def, def.EvalAct_LaunchEarthquake], { Strength={Function="int_constant", Value=50} }, { Type="proplist", Display="{{Position}}, {{Strength}}", EditorProps = { + Position = new UserAction.Evaluator.Position { EditorHelp="$PositionHelp$" }, + Strength = new UserAction.Evaluator.Integer { Name="$Strength$", EditorHelp="$StrengthHelp$" }, + } } ); +} + +private func EvalAct_LaunchEarthquake(proplist props, proplist context) +{ + // Earthquake through user action + var position = UserAction->EvaluatePosition(props.Position, context); + var strength = UserAction->EvaluateValue("Integer", props.Strength, context); + if (strength > 0) + { + LaunchEarthquake(position[0], position[1], strength); + } +} diff --git a/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/StringTblDE.txt b/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/StringTblDE.txt index c36803d38..17865862a 100644 --- a/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/StringTblDE.txt +++ b/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/StringTblDE.txt @@ -1 +1,6 @@ Name=Erdbeben +LaunchEarthquake=Erdbeben +LaunchEarthquakeHelp=Laesst die Erde wackeln, Objekte schleudern und lose Materialien herunter fallen. +PositionHelp=Wo die Erde wackelt. +Strength=Staerke +StrengthHelp=Radius und Staerke des Wackelns. diff --git a/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/StringTblUS.txt b/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/StringTblUS.txt index ceccb25f7..05b29dcf9 100644 --- a/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/StringTblUS.txt +++ b/planet/Objects.ocd/Environment.ocd/Disasters.ocd/Earthquake.ocd/StringTblUS.txt @@ -1 +1,6 @@ Name=Earthquake +LaunchEarthquake=Earthquake +LaunchEarthquakeHelp=Shakes the ground, flings objects and drops loose materials. +PositionHelp=Where the earth shakes. +Strength=Strength +StrengthHelp=Radius and strength of the shaking. \ No newline at end of file diff --git a/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/Script.c b/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/Script.c index 694121c3f..528181c64 100644 --- a/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/Script.c +++ b/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/Script.c @@ -26,7 +26,7 @@ local EvaluatorDefs; local DefinitionPriority=99; // Localized group names -local GroupNames = { Structure="$Structure$", Game="$Game$", Ambience="$Ambience$" }; +local GroupNames = { Structure="$Structure$", Game="$Game$", Ambience="$Ambience$", Disasters="$Disasters$" }; // Storage for global user variables static g_UserAction_global_vars; diff --git a/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/StringTblDE.txt b/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/StringTblDE.txt index e81b9d950..8f0244d55 100644 --- a/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/StringTblDE.txt +++ b/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/StringTblDE.txt @@ -15,6 +15,7 @@ UserAny=Wert Default=Standard Structure=Gebaeude Game=Spiel +Disasters=Katastrophen None=Nichts Noone=Niemand AllPlayers=Alle Spieler diff --git a/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/StringTblUS.txt b/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/StringTblUS.txt index f6e3b4483..d39126002 100644 --- a/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/StringTblUS.txt +++ b/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/StringTblUS.txt @@ -15,6 +15,7 @@ UserAny=Value Default=Default Structure=Structure Game=Game +Disasters=Disasters None=Nothing Noone=Noone AllPlayers=All players