ID:1861835
 
(See the best response by Lummox JR.)
Code:
turf/mine/proc/work()
for(var/turf/t in orange(1, src))
if(istype(t,/turf/village))
for(var/turf/i in orange(1, src))
if(istype(i,/turf/hill))
t.stone = t.stone + 0.5
i.subDurability(1, "grass")


Problem description:
How I should add stones to the t (a village turf) and slowly destroy the i (a hill turf)?

Did you mean for i to be in orange(1,t), or is src the correct center? That is, your current code will act on turfs that are adjacent to src (the mine).

The nested loops aren't really so wonderful, as you're wasting a lot of cycles on the same things. Instead, I'd separate the loops. There's no reason the i loop has to be inside the t loop as long as they're both centered on src.

I'd create two temporary lists. From all turfs in orange(1,src) (so you only loop once), add a turf to the hill list if it's a hill, and the village list if it's a village turf.

Then, to be equivalent to your current code you would add 0.5*hills.len to the stone var for each turf in the village list, and then for each hill you would call subDurability().

Another way to do this, which is more interesting, is to pick a turf at random from each list.
Isn't it possible to modify the current code to accommodate the needs? I want to destroy the the /turf/hill, and add the stones to /turf/village.
The current code is using a nested loop it doesn't have to. Don't even try to keep that design. Non-nested loops are better than nested loops every time it's feasible to use them.
I don't know how to use your idea. Will you help to modify the code to work with lists?
Rough example:

var/list/hills = new
var/list/village = new
for(var/turf/t in orange(1,src))
if(istype(t, /turf/hill)) hills += t
else if(istype(t, /turf/village)) village += t
if(!hills.len || !village.len) return
var/turf/H = pick(hills)
var/turf/V = pick(village)
...
where I should insert the code? In the work proc?
and how to add stones to the village and call the subDurability on hill
Yes, that would be in the work proc. Adding stones and calling subDurability should be fairly self-evident.
I don't know. Should I add them after H (hill destroying) and V (village stones adding)?
I don't know. Should I add them after H (hill destroying) and V (village stones adding)? Will someone help me?
All this is is a variation on the code you already posted. I'm not sure how I could clarify this any further.
But what I should add to the code to destroy the hills and add stones to villages? H.subDurability(1, "grass") doesn't work.
Best response
But why doesn't it work? I haven't seen the part of the code containing subDurability(), so I can only make assumptions as to what it does. This being your code, you know better than we do what's in that proc.
Hey! I GOT IT TO WORK by rewriting the subDurability proc as a whole, not as a proc for every turf.