Advertisement
Guest User

asdasfasf

a guest
Oct 24th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.20 KB | None | 0 0
  1. //=========>Set value // Initial Reference Value <=============
  2. #define GRASS_SPONTANEOUS 2//2 //chance it appears on the tile on its own
  3. #define GRASS_WEIGHT 4//4 //multiplier increase if theres some nearby
  4. #define TREE_SPONTANEOUS 4//2
  5. #define TREE_WEIGHT 4//4
  6. #define AUSFLORA_SPONTANEOUS 2//2
  7. #define AUSFLORA_WEIGHT 3//4
  8. #define ROCKS_SPONTANEOUS 2//2 //Technically this can be moved to the desolate spawn list tied to grass.
  9. #define ROCKS_WEIGHT 1//1 //Lower weight cause rock clusters were too common...But cool honestly.
  10. #define DEBRIS_SPONTANEOUS 2//2
  11. #define DEBRIS_WEIGHT 2//2
  12.  
  13. //These are basically what can spawn in the lists, the number is the weight.
  14. //The weight dictates how likely it is to spawn over other things in the lists. If you were to use pickweight.
  15. #define LUSH_GRASS_SPAWN_LIST list(/obj/structure/flora/grass/spookytime = 4,\
  16. /obj/structure/flora/ausbushes/lavendergrass = 3,\
  17. /obj/structure/flora/ausbushes/sparsegrass = 6,\
  18. /obj/structure/flora/ausbushes/fullgrass = 1\
  19. )
  20.  
  21. #define TREE_SPAWN_LIST list(/obj/structure/flora/tree/spookytime = 9,\
  22. /obj/structure/flora/tree/spookytimexl = 2,\
  23. /obj/structure/flora/tree/jungle = 1,\
  24. /obj/structure/flora/tree/jungle/small = 1\
  25. )
  26.  
  27. #define AUSFLORA_SPAWN_LIST list(/obj/structure/flora/ausbushes = 3,\
  28. /obj/structure/flora/ausbushes/grassybush = 3,\
  29. /obj/structure/flora/ausbushes/fernybush = 1,\
  30. /obj/structure/flora/ausbushes/sunnybush = 1,\
  31. /obj/structure/flora/ausbushes/reedbush = 1,\
  32. /obj/structure/flora/ausbushes/palebush = 1,\
  33. /obj/structure/flora/ausbushes/stalkybush = 1\
  34. )
  35.  
  36. #define ROCKS_SPAWN_LIST list(/obj/structure/flora/spookyrock = 1\
  37. )
  38.  
  39. #define DEBRIS_SPAWN_LIST list(/obj/structure/flora/tree/spookybranch = 5, \
  40. /obj/structure/flora/tree/spookylog = 1\
  41. )
  42.  
  43. //Lists that occur when the cluster doesn't happen but probability dictates it tries.
  44. #define DESOLATE_SPAWN_LIST list(/obj/structure/flora/grass/spookytime = 1,\
  45. /obj/structure/flora/ausbushes/sparsegrass = 1\
  46. )
  47.  
  48. //I just kinda made it worse... Like a lot worse. Ngl man.
  49. /turf/open/floor/spooktime/spooktimegrass/proc/floraGen()
  50. var/grassWeight = 0 //grassWeight holders for each individual layer
  51. var/treeWeight = 0
  52. var/ausfloraWeight = 0
  53. var/rocksWeight = 0
  54. var/debrisWeight = 0
  55.  
  56. var/randGrass = null //The random plant picked
  57. var/randTree = null //The random deadtree picked
  58. var/randAusflora = null //The random Ausflora picked
  59. var/randRocks = null //The random rock picked
  60. var/randDebris = null //The random wood debris picked
  61.  
  62. //spontaneously spawn the objects based on probability from the define.
  63. //Ngl, a lot of this is going to be have to generate in certain orders later in this proc.
  64. if(prob(GRASS_SPONTANEOUS))
  65. randGrass = pickweight(LUSH_GRASS_SPAWN_LIST) //Create a new grass object at this location, and assign var
  66. turfGrass = new randGrass(src) //The var on the turf now has a new randgrass from the list.
  67.  
  68. if(prob(TREE_SPONTANEOUS))
  69. randTree = pickweight(TREE_SPAWN_LIST)
  70. turfTree = new randTree(src)
  71.  
  72. if(prob(AUSFLORA_SPONTANEOUS))
  73. randAusflora = pickweight(AUSFLORA_SPAWN_LIST)
  74. turfAusflora = new randAusflora(src)
  75.  
  76. if(prob(ROCKS_SPONTANEOUS))
  77. randRocks = pickweight(ROCKS_SPAWN_LIST)
  78. turfRocks = new randRocks(src)
  79.  
  80. if(prob(DEBRIS_SPONTANEOUS))
  81. randDebris = pickweight(DEBRIS_SPAWN_LIST)
  82. turfDebris = new randDebris(src)
  83.  
  84.  
  85. //loop through neighbouring turfs, if they have grass, then increase weight, cluster prep.
  86. for(var/turf/open/floor/spooktime/spooktimegrass/T in RANGE_TURFS(3, src))
  87. if(T.turfGrass) //We check what is around our turf
  88. grassWeight += GRASS_WEIGHT //The weight is increased by grass weight per every grass we find
  89. if(T.turfTree)
  90. treeWeight += TREE_WEIGHT
  91. if(T.turfAusflora)
  92. ausfloraWeight += AUSFLORA_WEIGHT
  93. if(T.turfRocks)
  94. rocksWeight += ROCKS_WEIGHT
  95. if(T.turfDebris)
  96. debrisWeight += DEBRIS_WEIGHT
  97.  
  98.  
  99. //Below is where we handle clusters really.
  100. //use weight to try to spawn grass
  101. if(prob(grassWeight)) //Basically after the earlier calc, we now roll probability.
  102. //If surrounded on 5+ sides, pick from lush
  103. if(grassWeight == (5 * GRASS_WEIGHT)) //If we are five times the define value, aka 5 detected.
  104. randGrass = pickweight(LUSH_GRASS_SPAWN_LIST) //We weighted pick from the lush list, aka boys that can be together.
  105. else //Else.
  106. randGrass = pickweight(DESOLATE_SPAWN_LIST) //We weighted pick from boys that are fine being alone.
  107. turfGrass = new randGrass(src) //And at the end we set the turfgrass to this object.
  108.  
  109. if(prob(treeWeight)) //We can technically redirect individuals down here too, but lets just focus on clumps.
  110. randTree = pickweight(TREE_SPAWN_LIST)
  111. turfTree = new randTree(src)
  112.  
  113. if(prob(ausfloraWeight))
  114. randAusflora = pickweight(AUSFLORA_SPAWN_LIST)
  115. turfAusflora = new randAusflora(src)
  116.  
  117. if(prob(rocksWeight))
  118. randRocks = pickweight(ROCKS_SPAWN_LIST)
  119. turfRocks = new randRocks(src)
  120.  
  121. if(prob(debrisWeight))
  122. randDebris = pickweight(DEBRIS_SPAWN_LIST)
  123. turfDebris = new randDebris(src)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement