# HG changeset patch
# User sheepluva
# Date 1416763014 -3600
# Node ID 7b74aa1bb58d45e0788197478e962681c1dae36b
# Parent  de6ab85ac7611151a8a8736c34136feaa652d9c8
Lua API:
onSpritePlacement(spriteId, centerX, centerY)
onGirderPlacement(frameIdx, centerX, centerY)
onRubberPlacement(frameIdx, centerX, centerY)

diff -r de6ab85ac761 -r 7b74aa1bb58d hedgewars/uLandGraphics.pas
--- a/hedgewars/uLandGraphics.pas	Sun Nov 23 16:13:35 2014 +0100
+++ b/hedgewars/uLandGraphics.pas	Sun Nov 23 18:16:54 2014 +0100
@@ -54,7 +54,7 @@
 function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture;
 
 implementation
-uses SDLh, uLandTexture, uTextures, uVariables, uUtils, uDebug;
+uses SDLh, uLandTexture, uTextures, uVariables, uUtils, uDebug, uScript;
 
 
 procedure calculatePixelsCoordinates(landX, landY: Longint; var pixelX, pixelY: Longint); inline;
@@ -722,7 +722,14 @@
 w:= Min(cpX + Image^.w, LAND_WIDTH) - x;
 y:= Max(cpY, topY);
 h:= Min(cpY + Image^.h, LAND_HEIGHT) - y;
-UpdateLandTexture(x, w, y, h, true)
+UpdateLandTexture(x, w, y, h, true);
+
+ScriptCall('onSpritePlacement', ord(Obj), cpX + w div 2, cpY + h div 2);
+if Obj = sprAmGirder then
+    ScriptCall('onGirderPlacement', frame, cpX + w div 2, cpY + h div 2)
+else if Obj = sprAmRubber then
+    ScriptCall('onRubberPlacement', frame, cpX + w div 2, cpY + h div 2);
+
 end;
 
 function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture;