From 03d0bb49dc83ac553e02608dcc1399b78e69e481 Mon Sep 17 00:00:00 2001 From: Maikel de Vries Date: Sat, 3 Mar 2018 12:27:34 +0100 Subject: [PATCH] c4script: some fixes for style guidelines and typos --- planet/Objects.ocd/Animals.ocd/Piranha.ocd/Script.c | 2 -- .../Libraries.ocd/CarryHeavyControl.ocd/Script.c | 10 +++++----- .../Libraries.ocd/ClonkControl.ocd/Script.c | 2 +- .../Destructible.ocd/Fragment.ocd/Script.c | 4 ++-- .../Libraries.ocd/Destructible.ocd/Script.c | 2 +- planet/Objects.ocd/Vehicles.ocd/Lorry.ocd/Script.c | 4 ++-- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/planet/Objects.ocd/Animals.ocd/Piranha.ocd/Script.c b/planet/Objects.ocd/Animals.ocd/Piranha.ocd/Script.c index 78a629ee6..e2be8f6db 100644 --- a/planet/Objects.ocd/Animals.ocd/Piranha.ocd/Script.c +++ b/planet/Objects.ocd/Animals.ocd/Piranha.ocd/Script.c @@ -94,8 +94,6 @@ func DoEat(object obj) obj->DoEnergy(-BiteStrength); hunger -= 20; if (hunger < 0) hunger = 0; - //CastParticles("MaterialParticle", 10, 10, 0, 0, 10, 20, RGB(200, 5, 5), RGB(200, 5, 5)); - DoEnergy(BiteStrength); } diff --git a/planet/Objects.ocd/Libraries.ocd/CarryHeavyControl.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/CarryHeavyControl.ocd/Script.c index 0c70ad3de..5ce9792d5 100644 --- a/planet/Objects.ocd/Libraries.ocd/CarryHeavyControl.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/CarryHeavyControl.ocd/Script.c @@ -107,7 +107,7 @@ public func GetExtraInteractions() var functions = _inherited(...); // dropping carry heavy - if(IsCarryingHeavy() && GetAction() == "Walk") + if (IsCarryingHeavy() && GetAction() == "Walk") { var ch = GetCarryHeavy(); PushBack(functions, {Fn = "DropCarryHeavy", Description=ch->GetDropDescription(), Object=this, IconName="", IconID=Icon_LetGo, Priority=1}); @@ -120,13 +120,13 @@ public func GetExtraInteractions() /** Tells the clonk that he is carrying the given carry heavy object */ public func CarryHeavy(object target) { - if(!target) + if (!target) return; // actually.. is it a carry heavy object? - if(!target->~IsCarryHeavy()) + if (!target->~IsCarryHeavy()) return; - // only if not carrying a heavy objcet already - if(IsCarryingHeavy()) + // only if not carrying a heavy object already + if (IsCarryingHeavy()) return; lib_carryheavy_obj = target; diff --git a/planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c index 64e8c1e27..49885c768 100644 --- a/planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c @@ -110,7 +110,7 @@ protected func OnActionChanged(string oldaction) Description = A description of what the interaction does IconID = ID of the definition that contains the icon (like GetInteractionMetaInfo) IconName = Name of the graphic for the icon (like GetInteractionMetaInfo) - Priority = Where to sort in in the interaction-list. 0=front, 10=after script, 20=after vehicles, 30=after structures, nil means no preverence + Priority = Where to sort in in the interaction-list. 0=front, 10=after script, 20=after vehicles, 30=after structures, nil means no preference */ public func GetExtraInteractions() { diff --git a/planet/Objects.ocd/Libraries.ocd/Destructible.ocd/Fragment.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Destructible.ocd/Fragment.ocd/Script.c index 124a76df6..0fe4a4cb0 100644 --- a/planet/Objects.ocd/Libraries.ocd/Destructible.ocd/Fragment.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Destructible.ocd/Fragment.ocd/Script.c @@ -8,7 +8,7 @@ local alpha; -func Initialize() +public func Initialize() { // Set graphics to a random fragment. var graphic = Random(4); @@ -20,7 +20,7 @@ func Initialize() AddTimer("ProcessFragment", 4); } -func ProcessFragment() +public func ProcessFragment() { // Remove object if con is too small or when alpha is too high. if (GetCon() < 40 || alpha > 200) diff --git a/planet/Objects.ocd/Libraries.ocd/Destructible.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Destructible.ocd/Script.c index abefcd00e..30fbfc770 100644 --- a/planet/Objects.ocd/Libraries.ocd/Destructible.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Destructible.ocd/Script.c @@ -17,7 +17,7 @@ local HitPoints = 0; // Don't override! local lib_destructible_is_damaged = false; -func Damage(int change, int cause, int by_player) +public func Damage(int change, int cause, int by_player) { _inherited(change, cause, by_player, ...); diff --git a/planet/Objects.ocd/Vehicles.ocd/Lorry.ocd/Script.c b/planet/Objects.ocd/Vehicles.ocd/Lorry.ocd/Script.c index 3ec3598da..ce07ca24a 100644 --- a/planet/Objects.ocd/Vehicles.ocd/Lorry.ocd/Script.c +++ b/planet/Objects.ocd/Vehicles.ocd/Lorry.ocd/Script.c @@ -238,8 +238,8 @@ public func TurnWheels() } } -// Custom fragments -func OnDestruction(int change, int cause, int by_player) +// Custom fragments on callback from destructible library. +public func OnDestruction(int change, int cause, int by_player) { // Only exit objects and parts if this lorry is not contained. if (!Contained())