diff --git a/Herbs/child_herb.lsl b/Herbs/child_herb.lsl index e69de29..214c856 100644 --- a/Herbs/child_herb.lsl +++ b/Herbs/child_herb.lsl @@ -0,0 +1,53 @@ +integer spawnTime = 600; //How long the herbs will cycle in spawn/death, change in HerbSpawner as well + + +// This checks that the player is actually able to see the herb +// From https://github.com/John-Nagle/lslutils/blob/master/touchtester.lsl +string freetouchpath(integer detected_num) +{ + key avi = llDetectedKey(detected_num); // first toucher + vector avpos = llDetectedPos(detected_num); // position of touching avi + vector touchpos = llDetectedTouchPos(detected_num); // position of touch + list raycast = llCastRay(avpos, touchpos, []); // check space between them + integer status = llList2Integer(raycast,-1); // last element is status + if (status == 0) // ray hit nothing + { return(""); } // no obstacle + // Hard case. Check for ray hitting avi or object being touched. Those don't count. + integer linknum = llDetectedLinkNumber(detected_num); // which link was touched + key linkkey = llGetLinkKey(linknum); // key of link touched + integer i; + for (i=0; i; + return wasPoint(radius); } default { - state_entry() + on_rez(integer start_param) + { + llResetScript(); + } + + changed(integer change) + { + if(change & CHANGED_INVENTORY) llResetScript(); + } + + timer() { - // Get the herb's position. - herbPosition = GetPosition(); - - // Get the current weather condition. - weatherCondition = GetWeatherCondition(); - - // Get the current season. - season = GetSeason(); - - // If the herb is not in the list of seasons it spawns in, destroy it. - if (herbSeason.find(season) == -1) - { - DestroyObject(); - } - - // If the weather condition is not clear, destroy the herb. - if (weatherCondition != "Clear") - { - DestroyObject(); - } + llSetTimerEvent(spawnTime); + llRezObject(herb, llGetPos() + wasPoint(radius), ZERO_VECTOR, ZERO_ROTATION, 0); } } \ No newline at end of file