proc/pickflowers()
var/list/onlyturf = list()
for(var/turf/flowers/T in orange(1,usr))
onlyturf += T //add the the only turf list
if(T)
var/endturf = pick(onlyturf) //pick from the onlyturf list so that there is ONLY 1 turf
var/turf/flowers/final = endturf //Make sure that there is only one turf
var/obj/item = new
item = pick(final.flowerslist)
item.loc = usr
I tried using break for this, but it still seems to give me more than 1 flower if I am next to say, 4 flower patches. I only want it to get 1 "Flower Patch" (randomly selected from everything in a radius of 1 tile from the usr) and pick 1 flower from that turf(It does this already).
So, if I am next to 4 flower patches, I get 4 flowers... how can I make it so that I only get 1 flower from the patches of flowers?
-ST
var/list/onlyturfs = list()
for(var/turf/flowers/f in orange(1,usr))
onlyturfs += f
break
if(onlyturfs.len > 0)
var/endturf = pick(onlyturfs)
var/turf/flowers/final = endturf
var/obj/item = new()
item = pick(final.flowerslist)
item.loc = usr
return 1
return 1
You may have better luck with this.