Not logged inOpenClonk Forum
Up Topic General / Help and Questions / Is there a way to know if Pickaxe or blasting was use?
- - By Anonymous [de] Date 2012-03-21 15:38
Hello,
is there a script way to know if Pickaxe or blasting was used for mining a material?

Greetings
Reply
Parent - - By Sven2 [de] Date 2012-03-21 16:00
No, because both rely on BlastFree to create the materials. The only way would be to modify the pickaxe or the explosion.

What do you need this information for?
Parent - - By Anonymous [de] Date 2012-03-21 16:05
I would like to give the player a bit more valuable objects if mined with a pickaxe (Blasting is more like destroying than carefulness like a pickaxe).
Reply
Parent - By Sven2 [de] Date 2012-03-21 17:15 Edited 2012-03-21 17:20
Maybe would should modify the BlastFree function to return an array of objects blasted free.

As a workaround, I guess you could search for newly created objects in the blasted range. Modifying the pickaxe like this (untested):

[...]
// Get objects before digging
var objects_before = FindObjects(Find_Distance(radius*2, x,y), Find_NoContainer());
// Dig
BlastFree(x,y, radius);
// Get objects after digging
var objects_after = FindObjects(Find_Distance(radius*2, x,y), Find_NoContainer());
// Do something on all objects present after, but not before digging
for (var obj in objects_after)
  if (GetIndexOf(obj, objects_before) < 0)
    DoSomething(obj);
Up Topic General / Help and Questions / Is there a way to know if Pickaxe or blasting was use?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill