init.lua 107 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693
  1. --Stuff from vessels
  2. -- -
  3. -- Copyright (C) 2012 Vanessa Ezekowitz
  4. -- Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
  5. -- This program is free software: you can redistribute it and/or modify
  6. -- it under the terms of the GNU General Public License as published by
  7. -- the Free Software Foundation, either version 3 of the License, or
  8. -- at your option) any later version.
  9. -- This program is distributed in the hope that it will be useful,
  10. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. -- GNU General Public License for more details.
  13. -- You should have received a copy of the GNU General Public License
  14. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. --changes so that bottles can't stack
  16. minetest.override_item("vessels:glass_bottle", {
  17. stack_max = 3,
  18. })
  19. local vessels_shelf_formspec =
  20. "size[8,7;]"..
  21. default.gui_bg..
  22. default.gui_bg_img..
  23. default.gui_slots..
  24. "list[context;vessels;0,0.3;8,2;]"..
  25. "list[current_player;main;0,2.85;8,1;]"..
  26. "list[current_player;main;0,4.08;8,3;8]"..
  27. "listring[context;vessels]"..
  28. "listring[current_player;main]"..
  29. default.get_hotbar_bg(0,2.85)
  30. minetest.register_node("witchcraft:shelf", {
  31. description = "Potion shelf",
  32. tiles = {"default_wood.png", "default_wood.png", "default_wood.png^vessels_shelf.png^vessels_shelf_overlay.png"},
  33. is_ground_content = false,
  34. groups = {choppy=3,oddly_breakable_by_hand=2,flammable=3},
  35. sounds = default.node_sound_wood_defaults(),
  36. on_construct = function(pos)
  37. local meta = minetest.get_meta(pos)
  38. meta:set_string("formspec", vessels_shelf_formspec)
  39. local inv = meta:get_inventory()
  40. inv:set_size("vessels", 8*2)
  41. end,
  42. can_dig = function(pos,player)
  43. local meta = minetest.get_meta(pos);
  44. local inv = meta:get_inventory()
  45. return inv:is_empty("vessels")
  46. end,
  47. allow_metadata_inventory_put = function(pos, listname, index, stack, player)
  48. local meta = minetest.get_meta(pos)
  49. local inv = meta:get_inventory()
  50. local to_stack = inv:get_stack(listname, index)
  51. if listname == "vessels" then
  52. if minetest.get_item_group(stack:get_name(), "potion") ~= 0
  53. or minetest.get_item_group(stack:get_name(), "potion2") ~= 0
  54. and to_stack:is_empty() then
  55. return 1
  56. end
  57. return 0
  58. end
  59. end,
  60. allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
  61. local meta = minetest.get_meta(pos)
  62. local inv = meta:get_inventory()
  63. local stack = inv:get_stack(from_list, from_index)
  64. local to_stack = inv:get_stack(to_list, to_index)
  65. if to_list == "vessels" then
  66. if minetest.get_item_group(stack:get_name(), "potion") ~= 0
  67. or minetest.get_item_group(stack:get_name(), "potion2") ~= 0
  68. and to_stack:is_empty() then
  69. return 1
  70. end
  71. return 0
  72. end
  73. end,
  74. on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
  75. minetest.log("action", player:get_player_name()..
  76. " moves stuff in vessels shelf at "..minetest.pos_to_string(pos))
  77. end,
  78. on_metadata_inventory_put = function(pos, listname, index, stack, player)
  79. minetest.log("action", player:get_player_name()..
  80. " puts stuff to vessels shelf at "..minetest.pos_to_string(pos))
  81. end,
  82. on_metadata_inventory_take = function(pos, listname, index, stack, player)
  83. minetest.log("action", player:get_player_name()..
  84. " takes stuff from vessels shelf at "..minetest.pos_to_string(pos))
  85. end,
  86. })
  87. --my stuff
  88. -- Copyright (C) 2016 DOOmed <heiselong@gmx.com>
  89. -- This program is free software; you can redistribute it and/or modify
  90. -- it under the terms of the GNU Lesser General Public License as published by
  91. -- the Free Software Foundation; either version 2.1 of the License, or
  92. -- (at your option) any later version.
  93. -- This program is distributed in the hope that it will be useful,
  94. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  95. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  96. -- GNU Lesser General Public License for more details.
  97. -- You should have received a copy of the GNU Lesser General Public License along
  98. -- with this program; if not, write to the Free Software Foundation, Inc.,
  99. -- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  100. --ingredients
  101. minetest.register_node("witchcraft:bottle_eyes", {
  102. description = "Jar of eyes",
  103. drawtype = "plantlike",
  104. tiles = {"witchcraft_jar_eyes.png"},
  105. inventory_image = "witchcraft_jar_eyes.png",
  106. wield_image = "witchcraft_jar_eyes.png",
  107. paramtype = "light",
  108. is_ground_content = false,
  109. walkable = false,
  110. stack_max = 1,
  111. selection_box = {
  112. type = "fixed",
  113. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  114. },
  115. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  116. sounds = default.node_sound_glass_defaults(),
  117. })
  118. minetest.register_node("witchcraft:bottle_slime", {
  119. description = "Jar of Slime",
  120. drawtype = "plantlike",
  121. tiles = {"witchcraft_jar_slime.png"},
  122. inventory_image = "witchcraft_jar_slime.png",
  123. wield_image = "witchcraft_jar_slime.png",
  124. paramtype = "light",
  125. is_ground_content = false,
  126. walkable = false,
  127. stack_max = 1,
  128. selection_box = {
  129. type = "fixed",
  130. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  131. },
  132. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  133. sounds = default.node_sound_glass_defaults(),
  134. })
  135. minetest.register_craftitem("witchcraft:herb", {
  136. description = "herb",
  137. inventory_image = "witchcraft_herbs.png"
  138. })
  139. minetest.register_craftitem("witchcraft:tooth", {
  140. description = "tooth",
  141. inventory_image = "witchcraft_tooth.png"
  142. })
  143. minetest.register_craftitem("witchcraft:horn", {
  144. description = "horn",
  145. inventory_image = "witchcraft_horn.png"
  146. })
  147. minetest.register_craftitem("witchcraft:bone", {
  148. description = "bone",
  149. inventory_image = "witchcraft_bone.png"
  150. })
  151. --crafting
  152. minetest.register_craft({
  153. output = 'witchcraft:shelf',
  154. recipe = {
  155. {'group:wood', 'group:wood', 'group:wood'},
  156. {'group:potion', 'group:potion', 'group:potion'},
  157. {'group:wood', 'group:wood', 'group:wood'},
  158. }
  159. })
  160. minetest.register_craft({
  161. output = 'witchcraft:bottle_eyes',
  162. recipe = {
  163. {'witchcraft:eye'},
  164. {'witchcraft:eye'},
  165. {'vessels:drinking_glass'},
  166. }
  167. })
  168. minetest.register_craft({
  169. output = "witchcraft:eye 2",
  170. type = "shapeless",
  171. recipe = {"witchcraft:bottle_eyes"}
  172. })
  173. minetest.register_craft({
  174. output = "witchcraft:herb 4",
  175. type = "shapeless",
  176. recipe = {"default:grass_5"}
  177. })
  178. minetest.register_craft({
  179. output = "witchcraft:herb 4",
  180. type = "shapeless",
  181. recipe = {"default:grass_4"}
  182. })
  183. minetest.register_craft({
  184. output = "witchcraft:herb 4",
  185. type = "shapeless",
  186. recipe = {"default:grass_3"}
  187. })
  188. minetest.register_craft({
  189. output = "witchcraft:herb 4",
  190. type = "shapeless",
  191. recipe = {"default:grass_2"}
  192. })
  193. minetest.register_craft({
  194. output = "witchcraft:herb 4",
  195. type = "shapeless",
  196. recipe = {"default:grass_1"}
  197. })
  198. minetest.register_craft({
  199. output = 'witchcraft:pot',
  200. recipe = {
  201. {'default:copper_lump', '', 'default:copper_lump'},
  202. {'default:copper_lump', '', 'default:copper_lump'},
  203. {'', 'default:copper_lump', ''},
  204. }
  205. })
  206. minetest.register_craft({
  207. output = 'witchcraft:mortar',
  208. recipe = {
  209. {'default:stone', '', 'default:stone'},
  210. {'default:stone', '', 'default:stone'},
  211. {'', 'default:stone', ''},
  212. }
  213. })
  214. minetest.register_craft({
  215. output = 'witchcraft:pentagram',
  216. recipe = {
  217. {'default:torch', 'default:clay', 'default:torch'},
  218. }
  219. })
  220. minetest.register_craft({
  221. output = 'witchcraft:small_bottle',
  222. recipe = {
  223. {'vessels:glass_fragments', 'vessels:glass_fragments', 'vessels:glass_fragments'},
  224. }
  225. })
  226. minetest.register_craft({
  227. output = 'witchcraft:bottle_medicine 2',
  228. recipe = {
  229. {'witchcraft:small_bottle', 'witchcraft:potion_red', 'witchcraft:small_bottle'},
  230. },
  231. replacements = {
  232. {"witchcraft:potion_red", "vessels:glass_bottle"}
  233. }
  234. })
  235. minetest.register_craft({
  236. output = 'witchcraft:mud_bottle',
  237. recipe = {
  238. {'default:dirt'},
  239. {'witchcraft:small_bottle'},
  240. },
  241. })
  242. minetest.register_craft({
  243. output = 'witchcraft:bone_bottle',
  244. recipe = {
  245. {'bones:bones'},
  246. {'witchcraft:small_bottle'},
  247. },
  248. })
  249. minetest.register_craft({
  250. output = 'witchcraft:herb_bottle',
  251. recipe = {
  252. {'witchcraft:herb'},
  253. {'witchcraft:small_bottle'},
  254. },
  255. })
  256. minetest.register_craft({
  257. output = 'witchcraft:slime_bottle',
  258. recipe = {
  259. {'witchcraft:bottle_slime'},
  260. {'witchcraft:small_bottle'},
  261. },
  262. replacements = {
  263. {"witchcraft:bottle_slime", "vessels:drinking_glass"}
  264. }
  265. })
  266. minetest.register_craft({
  267. output = 'witchcraft:herb',
  268. recipe = {
  269. {'witchcraft:herb_bottle'},
  270. },
  271. replacements = {
  272. {"witchcraft:herb_bottle", "witchcraft:small_bottle"}
  273. }
  274. })
  275. minetest.register_craft({
  276. output = 'bones:bones',
  277. recipe = {
  278. {'witchcraft:bone_bottle'},
  279. },
  280. replacements = {
  281. {"witchcraft:bone_bottle", "witchcraft:small_bottle"}
  282. }
  283. })
  284. minetest.register_craft({
  285. output = 'default:dirt',
  286. recipe = {
  287. {'witchcraft:mud_bottle'},
  288. },
  289. replacements = {
  290. {"witchcraft:mud_bottle", "witchcraft:small_bottle"}
  291. }
  292. })
  293. minetest.register_craft({
  294. output = 'witchcraft:bottle_slime',
  295. recipe = {
  296. {'witchcraft:slime_bottle'},
  297. },
  298. replacements = {
  299. {"witchcraft:slime_bottle", "witchcraft:small_bottle"}
  300. }
  301. })
  302. minetest.register_craft({
  303. output = 'witchcraft:slime_bottle',
  304. recipe = {
  305. {'witchcraft:bottle_slime'},
  306. {'witchcraft:small_bottle'},
  307. },
  308. })
  309. minetest.register_craft({
  310. output = 'vessels:glass_fragments 3',
  311. type = "shapeless",
  312. recipe = {"default:glass"}
  313. })
  314. minetest.register_craft({
  315. output = 'witchcraft:bone 4',
  316. recipe = {
  317. {'bones:bones', 'bones:bones'},
  318. },
  319. })
  320. --teeth from sand, maybe fossilised?
  321. minetest.register_craft({
  322. output = 'witchcraft:tooth 1',
  323. type = "shapeless",
  324. recipe = {"default:sand"}
  325. })
  326. --splash potions crafting
  327. minetest.register_craft({
  328. output = 'witchcraft:splash_yellwgrn',
  329. recipe = {
  330. {'vessels:glass_fragments'},
  331. {'witchcraft:potion_yllwgrn'},
  332. }
  333. })
  334. minetest.register_craft({
  335. output = 'witchcraft:splash_orange',
  336. recipe = {
  337. {'vessels:glass_fragments'},
  338. {'witchcraft:potion_orange'},
  339. }
  340. })
  341. minetest.register_craft({
  342. output = 'witchcraft:splash_purple',
  343. recipe = {
  344. {'vessels:glass_fragments'},
  345. {'witchcraft:potion_purple'},
  346. }
  347. })
  348. minetest.register_craft({
  349. output = 'witchcraft:splash_magenta',
  350. recipe = {
  351. {'vessels:glass_fragments'},
  352. {'witchcraft:potion_magenta'},
  353. }
  354. })
  355. minetest.register_craft({
  356. output = 'witchcraft:splash_cyan',
  357. recipe = {
  358. {'vessels:glass_fragments'},
  359. {'witchcraft:potion_cyan'},
  360. }
  361. })
  362. minetest.register_craft({
  363. output = 'witchcraft:splash_red',
  364. recipe = {
  365. {'vessels:glass_fragments'},
  366. {'witchcraft:potion_red'},
  367. }
  368. })
  369. minetest.register_craft({
  370. output = 'witchcraft:splash_green',
  371. recipe = {
  372. {'vessels:glass_fragments'},
  373. {'witchcraft:potion_green'},
  374. }
  375. })
  376. minetest.register_craft({
  377. output = 'witchcraft:splash_grey',
  378. recipe = {
  379. {'vessels:glass_fragments'},
  380. {'witchcraft:potion_grey'},
  381. }
  382. })
  383. minetest.register_craft({
  384. output = 'witchcraft:splash_brown',
  385. recipe = {
  386. {'vessels:glass_fragments'},
  387. {'witchcraft:potion_brown'},
  388. }
  389. })
  390. minetest.register_craft({
  391. output = 'witchcraft:splash_redbrown',
  392. recipe = {
  393. {'vessels:glass_fragments'},
  394. {'witchcraft:potion_redbrown'},
  395. }
  396. })
  397. minetest.register_craft({
  398. output = 'witchcraft:splash_ggreen',
  399. recipe = {
  400. {'vessels:glass_fragments'},
  401. {'witchcraft:potion_ggreen'},
  402. }
  403. })
  404. --empty cooking pot
  405. minetest.register_node("witchcraft:pot", {
  406. description = "magic cooking pot",
  407. tiles = {
  408. "witchcraft_pot_top.png",
  409. "witchcraft_pot_bottom.png",
  410. "witchcraft_pot_side.png",
  411. "witchcraft_pot_side.png",
  412. "witchcraft_pot_side.png",
  413. "witchcraft_pot_side.png"
  414. },
  415. drawtype = "nodebox",
  416. paramtype = "light",
  417. node_box = {
  418. type = "fixed",
  419. fixed = {
  420. {-0.4375, -0.5, -0.4375, 0.4375, -0.4375, 0.4375}, -- NodeBox1
  421. {-0.375, -0.4375, -0.375, 0.375, -0.375, 0.375}, -- NodeBox2
  422. {-0.3125, -0.375, -0.3125, 0.3125, -0.3125, 0.3125}, -- NodeBox3
  423. {-0.375, -0.3125, -0.375, 0.375, -0.25, 0.375}, -- NodeBox4
  424. {-0.4375, -0.25, -0.4375, 0.4375, -0.1875, 0.4375}, -- NodeBox5
  425. {-0.5, -0.1875, -0.5, 0.5, -0.125, 0.5}, -- NodeBox7
  426. {-0.5, -0.125, -0.5, 0.5, 0.3125, -0.3125}, -- NodeBox8
  427. {-0.5, -0.125, 0.3125, 0.5, 0.3125, 0.5}, -- NodeBox9
  428. {0.3125, -0.1875, -0.5, 0.5, 0.3125, 0.5}, -- NodeBox10
  429. {-0.5, -0.125, -0.5, -0.3125, 0.3125, 0.5}, -- NodeBox11
  430. {-0.4375, 0.375, 0.3125, 0.4375, 0.5, 0.4375}, -- NodeBox12
  431. {-0.4375, 0.375, -0.4375, 0.4375, 0.5, -0.3125}, -- NodeBox13
  432. {-0.4375, 0.375, -0.4375, 0.4375, 0.5, -0.3125}, -- NodeBox14
  433. {0.3125, 0.375, -0.4375, 0.4375, 0.5, 0.4375}, -- NodeBox15
  434. {-0.4375, 0.375, -0.4375, -0.3125, 0.5, 0.4375}, -- NodeBox16
  435. {-0.375, 0.3125, -0.375, 0.375, 0.375, -0.3125}, -- NodeBox17
  436. {-0.375, 0.3125, 0.3125, 0.375, 0.375, 0.375}, -- NodeBox18
  437. {0.3125, 0.3125, -0.375, 0.375, 0.375, 0.375}, -- NodeBox19
  438. {-0.375, 0.3125, -0.375, -0.3125, 0.375, 0.375}, -- NodeBox20
  439. }
  440. },
  441. on_rightclick = function(pos, node, clicker, item, _)
  442. local wield_item = clicker:get_wielded_item():get_name()
  443. if wield_item == "bucket:bucket_water" or
  444. wield_item == "bucket:bucket_river_water" then
  445. minetest.set_node(pos, {name="witchcraft:pot_blue", param2=node.param2})
  446. item:replace("bucket:bucket_empty")
  447. elseif wield_item == "vessels:drinking_glass" then
  448. item:replace("witchcraft:bottle_slime")
  449. end
  450. end,
  451. groups = {cracky=1, falling_node=1, oddly_breakable_by_hand=1}
  452. })
  453. --level 1 potions from cooking pot
  454. local witchcraft = {}
  455. witchcraft.pot = {
  456. {"blue", "blue2", "flowers:waterlily", "brown", "default:dirt", "red", "purple"},
  457. {"blue2", "green", "default:papyrus", "", "", "gred", "magenta"},
  458. {"green", "green2", "default:sapling", "", "", "yellow", "yllwgrn"},
  459. {"green2", "yellow", "default:mese_crystal_fragment", "", "", "blue", "cyan"},
  460. {"yellow", "ggreen", "flowers:mushroom_brown", "", "", "green", "yllwgrn"},
  461. {"ggreen", "cyan", "witchcraft:slime_bottle", "", "", "gcyan", "aqua"},
  462. {"cyan", "gcyan", "witchcraft:bottle_medicine", "", "", "blue", "blue2"},
  463. {"gcyan", "orange", "default:torch", "", "", "ggreen", "aqua"},
  464. {"orange", "yllwgrn", "tnt:gunpowder", "", "", "red", "redbrown"},
  465. {"yllwgrn", "gold", "default:steel_ingot", "", "", "green", "green2"},
  466. {"gold", "aqua", "default:diamond", "", "", "", ""},
  467. {"aqua", "", "", "", "", "", ""},
  468. {"brown", "redbrown", "flowers:mushroom_red", "", "", "red", "redbrown"},
  469. {"redbrown", "gred", "default:apple", "", "", "", ""},
  470. {"gred", "red", "witchcraft:herbs", "", "", "blue2", "magenta"},
  471. {"red", "magenta", "witchcraft:tooth", "", "", "blue", "purple"},
  472. {"magenta", "gpurple", "witchcraft:bottle_slime", "", "", "cyan", "darkpurple"},
  473. {"gpurple", "purple", "witchcraft:bone_bottle", "", "", "yllwgrn", "green2"},
  474. {"purple", "darkpurple", "default:glass", "", "", "yellow", "green"},
  475. {"darkpurple", "silver", "default:steel_ingot", "", "", "", ""},
  476. {"silver", "grey", "witchcraft:bone", "", "", "", ""},
  477. {"grey", "aqua", "default:diamond", "", "", "", ""},
  478. }
  479. --potion pots
  480. for _, row in ipairs(witchcraft.pot) do
  481. local color = row[1]
  482. local newcolor = row[2]
  483. local newcolor2 = row[4]
  484. local ingredient = row[3]
  485. local ingredient2 = row[5]
  486. local combine = row[6]
  487. local cresult = row[7]
  488. minetest.register_node("witchcraft:pot_"..color, {
  489. tiles = {
  490. { name = "witchcraft_pot_"..color..".png",
  491. animation = {type="vertical_frames", length=3.0} },
  492. "witchcraft_pot_bottom.png",
  493. "witchcraft_pot_side.png",
  494. "witchcraft_pot_side.png",
  495. "witchcraft_pot_side.png",
  496. "witchcraft_pot_side.png"
  497. },
  498. drawtype = "nodebox",
  499. paramtype = "light",
  500. drop = {
  501. items = {
  502. {items = {'witchcraft:pot'}, rarity = 1},
  503. }
  504. },
  505. node_box = {
  506. type = "fixed",
  507. fixed = {
  508. {-0.4375, -0.5, -0.4375, 0.4375, -0.4375, 0.4375}, -- NodeBox1
  509. {-0.375, -0.4375, -0.375, 0.375, -0.375, 0.375}, -- NodeBox2
  510. {-0.3125, -0.375, -0.3125, 0.3125, -0.3125, 0.3125}, -- NodeBox3
  511. {-0.375, -0.3125, -0.375, 0.375, 0.5, 0.375}, -- NodeBox4
  512. {-0.4375, -0.25, -0.4375, 0.4375, 0.3125, 0.4375}, -- NodeBox5
  513. {-0.5, -0.1875, -0.5, 0.5, 0.3125, 0.5}, -- NodeBox6
  514. {-0.4375, 0.375, -0.4375, 0.4375, 0.5, 0.4375}, -- NodeBox7
  515. }
  516. },
  517. on_rightclick = function(pos, node, clicker, item, _)
  518. local wield_item = clicker:get_wielded_item():get_name()
  519. if wield_item == "vessels:glass_bottle" then
  520. item:replace("witchcraft:potion_"..color)
  521. if clicker:get_wielded_item():get_count() == 3 then
  522. minetest.env:add_item({x=pos.x, y=pos.y+1.5, z=pos.z}, "witchcraft:potion_"..color)
  523. minetest.env:add_item({x=pos.x, y=pos.y+1.5, z=pos.z}, "witchcraft:potion_"..color)
  524. end
  525. minetest.set_node(pos, {name="witchcraft:pot", param2=node.param2})
  526. elseif wield_item == ingredient then
  527. minetest.set_node(pos, {name="witchcraft:pot_"..newcolor, param2=node.param2})
  528. item:take_item()
  529. elseif wield_item == ingredient2 then
  530. minetest.set_node(pos, {name="witchcraft:pot_"..newcolor2, param2=node.param2})
  531. item:take_item()
  532. elseif wield_item == "bucket:bucket_water" then
  533. minetest.set_node(pos, {name="witchcraft:pot_blue", param2=node.param2})
  534. item:replace("bucket:bucket_empty")
  535. elseif wield_item == "witchcraft:potion_"..combine then
  536. minetest.set_node(pos, {name="witchcraft:pot_"..cresult, param2=node.param2})
  537. item:replace("vessels:glass_bottle")
  538. end
  539. end,
  540. groups = {cracky=1, falling_node=1, oddly_breakable_by_hand=1}
  541. })
  542. end
  543. --pot effects
  544. minetest.register_abm({
  545. nodenames = {"witchcraft:pot_water", "witchcraft:pot_gold", "witchcraft:pot_redbrown", "witchcraft:pot_blue2", "witchcraft:pot_cyan", "witchcraft:pot_green", "witchcraft:pot_green2", "witchcraft:pot_aqua", "witchcraft:pot_yellow", "witchcraft:pot_yllwgrn", "witchcraft:pot_red", "witchcraft:pot_magenta", "witchcraft:pot_brown"},
  546. interval = 0.5,
  547. chance = 1,
  548. action = function(pos, node)
  549. minetest.add_particlespawner({
  550. amount = 2,
  551. time = 1,
  552. minpos = {x=pos.x-0.1, y=pos.y, z=pos.z-0.1},
  553. maxpos = {x=pos.x+0.1, y=pos.y, z=pos.z+0.1},
  554. minvel = {x=0, y=0.5, z=0},
  555. maxvel = {x=0, y=0.6, z=0},
  556. minacc = {x=0, y=0.2, z=0},
  557. maxacc = {x=0, y=0.3, z=0},
  558. minexptime = 1,
  559. maxexptime = 2,
  560. minsize = 2,
  561. maxsize = 3,
  562. collisiondetection = false,
  563. texture = "witchcraft_bubbles.png"
  564. })
  565. end
  566. })
  567. minetest.register_abm({
  568. nodenames = {"witchcraft:pot_ggreen", "witchcraft:pot_gred", "witchcraft:pot_gpurple", "witchcraft:pot_gcyan"},
  569. interval = 0.5,
  570. chance = 1,
  571. action = function(pos, node)
  572. minetest.add_particlespawner({
  573. amount = 2,
  574. time = 1,
  575. minpos = {x=pos.x-0.1, y=pos.y, z=pos.z-0.1},
  576. maxpos = {x=pos.x+0.1, y=pos.y, z=pos.z+0.1},
  577. minvel = {x=0, y=0.5, z=0},
  578. maxvel = {x=0, y=0.6, z=0},
  579. minacc = {x=0, y=0.2, z=0},
  580. maxacc = {x=0, y=0.3, z=0},
  581. minexptime = 1,
  582. maxexptime = 2,
  583. minsize = 1,
  584. maxsize = 2,
  585. collisiondetection = false,
  586. texture = "witchcraft_light_over.png"
  587. })
  588. end
  589. })
  590. minetest.register_abm({
  591. nodenames = {"witchcraft:pot_purple"},
  592. interval = 0.5,
  593. chance = 1,
  594. action = function(pos, node)
  595. minetest.add_particlespawner({
  596. amount = 2,
  597. time = 1,
  598. minpos = {x=pos.x-0.1, y=pos.y, z=pos.z-0.1},
  599. maxpos = {x=pos.x+0.1, y=pos.y, z=pos.z+0.1},
  600. minvel = {x=0, y=0.5, z=0},
  601. maxvel = {x=0, y=0.6, z=0},
  602. minacc = {x=0, y=0.2, z=0},
  603. maxacc = {x=0, y=0.3, z=0},
  604. minexptime = 1,
  605. maxexptime = 2,
  606. minsize = 5,
  607. maxsize = 8,
  608. collisiondetection = false,
  609. texture = "witchcraft_smoke.png"
  610. })
  611. end
  612. })
  613. minetest.register_abm({
  614. nodenames = {"witchcraft:pot_darkpurple"},
  615. interval = 0.5,
  616. chance = 1,
  617. action = function(pos, node)
  618. minetest.add_particlespawner({
  619. amount = 2,
  620. time = 1,
  621. minpos = {x=pos.x-0.1, y=pos.y, z=pos.z-0.1},
  622. maxpos = {x=pos.x+0.1, y=pos.y, z=pos.z+0.1},
  623. minvel = {x=0, y=0.5, z=0},
  624. maxvel = {x=0, y=0.6, z=0},
  625. minacc = {x=0, y=0.2, z=0},
  626. maxacc = {x=0, y=0.3, z=0},
  627. minexptime = 1,
  628. maxexptime = 2,
  629. minsize = 2,
  630. maxsize = 3,
  631. collisiondetection = false,
  632. texture = "witchcraft_symbol.png"
  633. })
  634. end
  635. })
  636. minetest.register_abm({
  637. nodenames = {"witchcraft:pot_orange"},
  638. interval = 0.5,
  639. chance = 1,
  640. action = function(pos, node)
  641. minetest.add_particlespawner({
  642. amount = 2,
  643. time = 1,
  644. minpos = {x=pos.x-0.1, y=pos.y, z=pos.z-0.1},
  645. maxpos = {x=pos.x+0.1, y=pos.y, z=pos.z+0.1},
  646. minvel = {x=0, y=0.5, z=0},
  647. maxvel = {x=0, y=0.6, z=0},
  648. minacc = {x=0, y=0.2, z=0},
  649. maxacc = {x=0, y=0.3, z=0},
  650. minexptime = 1,
  651. maxexptime = 2,
  652. minsize = 2,
  653. maxsize = 3,
  654. collisiondetection = false,
  655. texture = "witchcraft_flame.png"
  656. })
  657. end
  658. })
  659. --small bottle and contents
  660. minetest.register_node("witchcraft:small_bottle", {
  661. description = "Small bottle",
  662. drawtype = "plantlike",
  663. tiles = {"witchcraft_small_bottle.png"},
  664. wield_image = "witchcraft_small_bottle.png",
  665. paramtype = "light",
  666. stack_max = 1,
  667. is_ground_content = false,
  668. walkable = false,
  669. selection_box = {
  670. type = "fixed",
  671. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  672. },
  673. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  674. sounds = default.node_sound_glass_defaults(),
  675. inventory_image = "witchcraft_small_bottle.png",
  676. })
  677. minetest.register_node("witchcraft:bone_bottle", {
  678. description = "Small bottle of bone dust",
  679. drawtype = "plantlike",
  680. tiles = {"witchcraft_bone_bottle.png"},
  681. wield_image = "witchcraft_bone_bottle.png",
  682. paramtype = "light",
  683. stack_max = 1,
  684. is_ground_content = false,
  685. walkable = false,
  686. selection_box = {
  687. type = "fixed",
  688. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  689. },
  690. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  691. sounds = default.node_sound_glass_defaults(),
  692. inventory_image = "witchcraft_bone_bottle.png",
  693. })
  694. minetest.register_node("witchcraft:slime_bottle", {
  695. description = "Small bottle of slime",
  696. drawtype = "plantlike",
  697. tiles = {"witchcraft_slime_bottle.png"},
  698. wield_image = "witchcraft_slime_bottle.png",
  699. paramtype = "light",
  700. stack_max = 1,
  701. is_ground_content = false,
  702. walkable = false,
  703. selection_box = {
  704. type = "fixed",
  705. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  706. },
  707. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  708. sounds = default.node_sound_glass_defaults(),
  709. inventory_image = "witchcraft_slime_bottle.png",
  710. })
  711. minetest.register_node("witchcraft:herb_bottle", {
  712. description = "Small bottle of herbs",
  713. drawtype = "plantlike",
  714. tiles = {"witchcraft_herb_bottle.png"},
  715. wield_image = "witchcraft_herb_bottle.png",
  716. paramtype = "light",
  717. stack_max = 1,
  718. is_ground_content = false,
  719. walkable = false,
  720. selection_box = {
  721. type = "fixed",
  722. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  723. },
  724. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  725. sounds = default.node_sound_glass_defaults(),
  726. inventory_image = "witchcraft_herb_bottle.png",
  727. })
  728. minetest.register_node("witchcraft:mud_bottle", {
  729. description = "Small bottle of mud",
  730. drawtype = "plantlike",
  731. tiles = {"witchcraft_mud_bottle.png"},
  732. wield_image = "witchcraft_mud_bottle.png",
  733. paramtype = "light",
  734. stack_max = 1,
  735. is_ground_content = false,
  736. walkable = false,
  737. selection_box = {
  738. type = "fixed",
  739. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  740. },
  741. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  742. sounds = default.node_sound_glass_defaults(),
  743. inventory_image = "witchcraft_mud_bottle.png",
  744. })
  745. minetest.register_node("witchcraft:bottle_medicine", {
  746. description = "Small bottle of Medicine",
  747. drawtype = "plantlike",
  748. tiles = {"witchcraft_medicine_bottle.png"},
  749. wield_image = "witchcraft_medicine_bottle.png",
  750. paramtype = "light",
  751. stack_max = 1,
  752. is_ground_content = false,
  753. walkable = false,
  754. selection_box = {
  755. type = "fixed",
  756. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  757. },
  758. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  759. sounds = default.node_sound_glass_defaults(),
  760. inventory_image = "witchcraft_medicine_bottle.png",
  761. on_use = function(itemstack, player)
  762. local health = player:get_hp();
  763. player:set_hp(health+10)
  764. itemstack:replace("witchcraft:small_bottle")
  765. return itemstack
  766. end,
  767. })
  768. --splash effects
  769. minetest.register_entity("witchcraft:tnt_splash", {
  770. textures = {"witchcraft_splash_yellgrn.png"},
  771. velocity = 0.1,
  772. damage = 2,
  773. collisionbox = {0, 0, 0, 0, 0, 0},
  774. on_step = function(self, obj, pos)
  775. local remove = minetest.after(2, function()
  776. self.object:remove()
  777. end)
  778. local pos = self.object:getpos()
  779. local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
  780. for k, obj in pairs(objs) do
  781. if obj:get_luaentity() ~= nil then
  782. if obj:get_luaentity().name ~= "witchcraft:tnt_splash" and obj:get_luaentity().name ~= "__builtin:item" then
  783. obj:punch(self.object, 1.0, {
  784. full_punch_interval=1.0,
  785. damage_groups={fleshy=3},
  786. }, nil)
  787. tnt.boom(pos, {damage_radius=5,radius=3,ignore_protection=false})
  788. self.object:remove()
  789. end
  790. end
  791. end
  792. for dx=0,1 do
  793. for dy=0,1 do
  794. for dz=0,1 do
  795. local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
  796. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  797. local n = minetest.env:get_node(p).name
  798. if n ~= "witchcraft:tnt_splash" and n ~="default:obsidian" and n ~= "air" then
  799. local pos = self.object:getpos()
  800. minetest.sound_play("default_break_glass.1", {
  801. pos = self.object:getpos(),
  802. gaint = 1.0,
  803. max_hear_distance = 20,
  804. })
  805. tnt.boom(pos, {damage_radius=5,radius=3,ignore_protection=false})
  806. self.object:remove()
  807. return
  808. end
  809. end
  810. end
  811. end
  812. hit_node = function(self, pos, node)
  813. local pos = self.object:getpos()
  814. for dx=-4,4 do
  815. for dy=-4,4 do
  816. for dz=-4,4 do
  817. local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  818. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  819. local n = minetest.env:get_node(pos).name
  820. if math.random(1, 50) <= 35 then
  821. tnt.boom(n, {damage_radius=5,radius=3,ignore_protection=false})
  822. end
  823. if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <=5 then
  824. if not ignore_protection and minetest.is_protected(npos, "") then
  825. return
  826. end
  827. minetest.env:set_node(t, {name="fire:basic_flame"})
  828. end
  829. end
  830. end
  831. end
  832. end
  833. end,
  834. })
  835. minetest.register_entity("witchcraft:fire_splash", {
  836. textures = {"witchcraft_splash_orange.png"},
  837. velocity = 0.1,
  838. damage = 2,
  839. collisionbox = {0, 0, 0, 0, 0, 0},
  840. on_step = function(self, obj, pos)
  841. local remove = minetest.after(2, function()
  842. self.object:remove()
  843. end)
  844. local pos = self.object:getpos()
  845. local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
  846. for k, obj in pairs(objs) do
  847. if obj:get_luaentity() ~= nil then
  848. if obj:get_luaentity().name ~= "witchcraft:fire_splash" and obj:get_luaentity().name ~= "__builtin:item" then
  849. obj:punch(self.object, 1.0, {
  850. full_punch_interval=1.0,
  851. damage_groups={fleshy=1},
  852. }, nil)
  853. self.object:remove()
  854. end
  855. end
  856. end
  857. for dx=0,1 do
  858. for dy=0,1 do
  859. for dz=0,1 do
  860. local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
  861. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  862. local n = minetest.env:get_node(p).name
  863. if n ~= "witchcraft:fire_splash" and n ~= "air" then
  864. if not ignore_protection and minetest.is_protected(npos, "") then
  865. return
  866. end
  867. minetest.env:set_node(t, {name="fire:basic_flame"})
  868. minetest.sound_play("default_break_glass.1", {
  869. pos = self.object:getpos(),
  870. max_hear_distance = 20,
  871. gain = 10.0,
  872. })
  873. self.object:remove()
  874. elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
  875. self.object:remove()
  876. return
  877. end
  878. end
  879. end
  880. end
  881. hit_node = function(self, pos, node)
  882. local pos = self.object:getpos()
  883. for dx=-4,4 do
  884. for dy=-4,4 do
  885. for dz=-4,4 do
  886. local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  887. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  888. local n = minetest.env:get_node(pos).name
  889. if math.random(1, 50) <= 1 then
  890. minetest.env:remove_node(p)
  891. end
  892. if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <=5 then
  893. minetest.env:set_node(t, {name="fire:basic_flame"})
  894. end
  895. end
  896. end
  897. end
  898. end
  899. end,
  900. })
  901. minetest.register_entity("witchcraft:death_splash", {
  902. textures = {"witchcraft_splash_grey.png"},
  903. velocity = 0.1,
  904. damage = 2,
  905. collisionbox = {0, 0, 0, 0, 0, 0},
  906. on_step = function(self, obj, pos)
  907. local remove = minetest.after(2, function()
  908. self.object:remove()
  909. end)
  910. local pos = self.object:getpos()
  911. local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
  912. for k, obj in pairs(objs) do
  913. if obj:get_luaentity() ~= nil then
  914. if obj:get_luaentity().name ~= "witchcraft:death_splash" and obj:get_luaentity().name ~= "__builtin:item" then
  915. obj:punch(self.object, 1.0, {
  916. full_punch_interval=1.0,
  917. damage_groups={fleshy=50},
  918. }, nil)
  919. self.object:remove()
  920. end
  921. end
  922. end
  923. for dx=0,1 do
  924. for dy=0,1 do
  925. for dz=0,1 do
  926. local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
  927. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  928. local n = minetest.env:get_node(p).name
  929. if n ~= "witchcraft:death_splash" and n ~= "air" then
  930. minetest.sound_play("default_break_glass.1", {
  931. pos = self.object:getpos(),
  932. max_hear_distance = 20,
  933. gain = 10.0,
  934. })
  935. self.object:remove()
  936. elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
  937. self.object:remove()
  938. return
  939. end
  940. end
  941. end
  942. end
  943. end,
  944. })
  945. minetest.register_entity("witchcraft:heal_splash", {
  946. textures = {"witchcraft_splash_red.png"},
  947. velocity = 0.1,
  948. damage = 2,
  949. collisionbox = {0, 0, 0, 0, 0, 0},
  950. on_step = function(self, obj, pos)
  951. local remove = minetest.after(2, function()
  952. self.object:remove()
  953. end)
  954. local pos = self.object:getpos()
  955. local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
  956. for k, obj in pairs(objs) do
  957. if obj:get_luaentity() ~= nil then
  958. if obj:get_luaentity().name ~= "witchcraft:heal_splash" and obj:get_luaentity().name ~= "__builtin:item" then
  959. obj:punch(self.object, 1.0, {
  960. full_punch_interval=1.0,
  961. damage_groups={fleshy=-20},
  962. }, nil)
  963. self.object:remove()
  964. end
  965. end
  966. end
  967. for dx=0,1 do
  968. for dy=0,1 do
  969. for dz=0,1 do
  970. local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
  971. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  972. local n = minetest.env:get_node(p).name
  973. if n ~= "witchcraft:heal_splash" and n ~= "air" then
  974. minetest.sound_play("default_break_glass.1", {
  975. pos = self.object:getpos(),
  976. max_hear_distance = 20,
  977. gain = 10.0,
  978. })
  979. self.object:remove()
  980. elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
  981. self.object:remove()
  982. return
  983. end
  984. end
  985. end
  986. end
  987. end,
  988. })
  989. minetest.register_entity("witchcraft:slow_splash", {
  990. textures = {"witchcraft_splash_redbrown.png"},
  991. velocity = 0.1,
  992. damage = 2,
  993. collisionbox = {0, 0, 0, 0, 0, 0},
  994. on_step = function(self, obj, pos)
  995. local remove = minetest.after(2, function()
  996. self.object:remove()
  997. end)
  998. local pos = self.object:getpos()
  999. local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
  1000. for k, obj in pairs(objs) do
  1001. if obj:get_luaentity() ~= nil then
  1002. if obj:get_luaentity().name ~= "witchcraft:slow_splash" and obj:get_luaentity().name ~= "__builtin:item" then
  1003. local vel = obj:getvelocity()
  1004. obj:setvelocity({x=vel.x*0.5, y=vel.y*0.5, z=vel.z*0.5})
  1005. self.object:remove()
  1006. end
  1007. end
  1008. end
  1009. for dx=0,1 do
  1010. for dy=0,1 do
  1011. for dz=0,1 do
  1012. local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
  1013. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  1014. local n = minetest.env:get_node(p).name
  1015. if n ~= "witchcraft:slow_splash" and n ~= "air" then
  1016. self.object:remove()
  1017. elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
  1018. minetest.sound_play("default_break_glass.1", {
  1019. pos = self.object:getpos(),
  1020. max_hear_distance = 20,
  1021. gain = 10.0,
  1022. })
  1023. self.object:remove()
  1024. return
  1025. end
  1026. end
  1027. end
  1028. end
  1029. end,
  1030. })
  1031. minetest.register_entity("witchcraft:fast_splash", {
  1032. textures = {"witchcraft_splash_magenta.png"},
  1033. velocity = 0.1,
  1034. damage = 2,
  1035. collisionbox = {0, 0, 0, 0, 0, 0},
  1036. on_step = function(self, obj, pos)
  1037. local remove = minetest.after(2, function()
  1038. self.object:remove()
  1039. end)
  1040. local pos = self.object:getpos()
  1041. local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
  1042. for k, obj in pairs(objs) do
  1043. if obj:get_luaentity() ~= nil then
  1044. if obj:get_luaentity().name ~= "witchcraft:fast_splash" and obj:get_luaentity().name ~= "__builtin:item" then
  1045. local vel = obj:getvelocity()
  1046. obj:setvelocity({x=vel.x*4, y=vel.y*1, z=vel.z*4})
  1047. self.object:remove()
  1048. end
  1049. end
  1050. end
  1051. for dx=0,1 do
  1052. for dy=0,1 do
  1053. for dz=0,1 do
  1054. local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
  1055. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  1056. local n = minetest.env:get_node(p).name
  1057. if n ~= "witchcraft:fast_splash" and n ~= "air" then
  1058. self.object:remove()
  1059. elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
  1060. minetest.sound_play("default_break_glass.1", {
  1061. pos = self.object:getpos(),
  1062. max_hear_distance = 20,
  1063. gain = 10.0,
  1064. })
  1065. self.object:remove()
  1066. return
  1067. end
  1068. end
  1069. end
  1070. end
  1071. end,
  1072. })
  1073. minetest.register_entity("witchcraft:antigrav_splash", {
  1074. textures = {"witchcraft_splash_green.png"},
  1075. velocity = 0.1,
  1076. damage = 2,
  1077. collisionbox = {0, 0, 0, 0, 0, 0},
  1078. on_step = function(self, obj, pos)
  1079. local remove = minetest.after(2, function()
  1080. self.object:remove()
  1081. end)
  1082. local pos = self.object:getpos()
  1083. local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
  1084. for k, obj in pairs(objs) do
  1085. if obj:get_luaentity() ~= nil then
  1086. if obj:get_luaentity().name ~= "witchcraft:antigrav_splash" and obj:get_luaentity().name ~= "__builtin:item" then
  1087. local vel = obj:getvelocity()
  1088. obj:setvelocity({x=vel.x*1, y=vel.y*0.1, z=vel.z*1})
  1089. self.object:remove()
  1090. end
  1091. end
  1092. end
  1093. for dx=0,1 do
  1094. for dy=0,1 do
  1095. for dz=0,1 do
  1096. local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
  1097. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  1098. local n = minetest.env:get_node(p).name
  1099. if n ~= "witchcraft:antigrav_splash" and n ~= "air" then
  1100. self.object:remove()
  1101. elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
  1102. minetest.sound_play("default_break_glass.1", {
  1103. pos = self.object:getpos(),
  1104. max_hear_distance = 20,
  1105. gain = 10.0,
  1106. })
  1107. self.object:remove()
  1108. return
  1109. end
  1110. end
  1111. end
  1112. end
  1113. end,
  1114. })
  1115. minetest.register_entity("witchcraft:jump_splash", {
  1116. textures = {"witchcraft_splash_cyan.png"},
  1117. velocity = 0.1,
  1118. damage = 2,
  1119. collisionbox = {0, 0, 0, 0, 0, 0},
  1120. on_step = function(self, obj, pos)
  1121. local remove = minetest.after(2, function()
  1122. self.object:remove()
  1123. end)
  1124. local pos = self.object:getpos()
  1125. local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
  1126. for k, obj in pairs(objs) do
  1127. if obj:get_luaentity() ~= nil then
  1128. if obj:get_luaentity().name ~= "witchcraft:jump_splash" and obj:get_luaentity().name ~= "__builtin:item" then
  1129. local vel = obj:getvelocity()
  1130. obj:setvelocity({x=vel.x*1, y=(vel.y+2)*3, z=vel.z*1})
  1131. self.object:remove()
  1132. end
  1133. end
  1134. end
  1135. for dx=0,1 do
  1136. for dy=0,1 do
  1137. for dz=0,1 do
  1138. local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
  1139. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  1140. local n = minetest.env:get_node(p).name
  1141. if n ~= "witchcraft:jump_splash" and n ~= "air" then
  1142. self.object:remove()
  1143. elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
  1144. minetest.sound_play("default_break_glass.1", {
  1145. pos = self.object:getpos(),
  1146. max_hear_distance = 20,
  1147. gain = 10.0,
  1148. })
  1149. self.object:remove()
  1150. return
  1151. end
  1152. end
  1153. end
  1154. end
  1155. end,
  1156. })
  1157. minetest.register_entity("witchcraft:murky_splash", {
  1158. textures = {"witchcraft_splash_brown.png"},
  1159. velocity = 0.1,
  1160. damage = 2,
  1161. collisionbox = {0, 0, 0, 0, 0, 0},
  1162. on_step = function(self, obj, pos)
  1163. local remove = minetest.after(2, function()
  1164. self.object:remove()
  1165. end)
  1166. local pos = self.object:getpos()
  1167. local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
  1168. for k, obj in pairs(objs) do
  1169. if obj:get_luaentity() ~= nil then
  1170. if obj:get_luaentity().name ~= "witchcraft:murky_splash" and obj:get_luaentity().name ~= "__builtin:item" then
  1171. obj:punch(self.object, 1.0, {
  1172. full_punch_interval=1.0,
  1173. damage_groups={fleshy=20},
  1174. }, nil)
  1175. self.object:remove()
  1176. end
  1177. end
  1178. end
  1179. for dx=0,1 do
  1180. for dy=0,1 do
  1181. for dz=0,1 do
  1182. local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
  1183. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  1184. local n = minetest.env:get_node(p).name
  1185. if n ~= "witchcraft:murky_splash" and n ~= "air" then
  1186. minetest.sound_play("default_break_glass.1", {
  1187. pos = self.object:getpos(),
  1188. max_hear_distance = 20,
  1189. gain = 10.0,
  1190. })
  1191. self.object:remove()
  1192. elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
  1193. self.object:remove()
  1194. return
  1195. end
  1196. end
  1197. end
  1198. end
  1199. end,
  1200. })
  1201. minetest.register_entity("witchcraft:shadow_splash", {
  1202. textures = {"witchcraft_splash_ggreen.png"},
  1203. velocity = 0.1,
  1204. damage = 2,
  1205. physical = true,
  1206. collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
  1207. on_step = function(self, obj, pos)
  1208. local remove = minetest.after(5, function()
  1209. self.object:remove()
  1210. end)
  1211. local pos = self.object:getpos()
  1212. minetest.add_particlespawner(
  1213. 50, --amount
  1214. 1, --time
  1215. {x=pos.x-3, y=pos.y-3, z=pos.z-3}, --minpos
  1216. {x=pos.x+3, y=pos.y+3, z=pos.z+3}, --maxpos
  1217. {x=-0, y=-0, z=-0}, --minvel
  1218. {x=0, y=0, z=0}, --maxvel
  1219. {x=-0.1,y=0.2,z=-0.1}, --minacc
  1220. {x=0.1,y=0.2,z=0.1}, --maxacc
  1221. 5, --minexptime
  1222. 10, --maxexptime
  1223. 10, --minsize
  1224. 20, --maxsize
  1225. false, --collisiondetection
  1226. "witchcraft_pot_bottom.png^[colorize:black:200" --texture
  1227. )
  1228. end,
  1229. })
  1230. minetest.register_entity("witchcraft:smoke_splash", {
  1231. textures = {"witchcraft_splash_purple.png"},
  1232. velocity = 0.1,
  1233. damage = 2,
  1234. physical = true,
  1235. collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
  1236. on_step = function(self, obj, pos)
  1237. local remove = minetest.after(10, function()
  1238. self.object:remove()
  1239. end)
  1240. local pos = self.object:getpos()
  1241. local velo = self.object:getvelocity()
  1242. self.object:setvelocity({x=velo.x*0.9,y=velo.y,z=velo.z*0.9})
  1243. minetest.add_particlespawner(
  1244. 10, --amount
  1245. 1, --time
  1246. {x=pos.x-1, y=pos.y-1, z=pos.z-1}, --minpos
  1247. {x=pos.x+1, y=pos.y+1, z=pos.z+1}, --maxpos
  1248. {x=-1, y=-0, z=-1}, --minvel
  1249. {x=1, y=0, z=1}, --maxvel
  1250. {x=-0.5,y=2,z=-0.5}, --minacc
  1251. {x=0.5,y=3,z=0.5}, --maxacc
  1252. 2, --minexptime
  1253. 4, --maxexptime
  1254. 10, --minsize
  1255. 20, --maxsize
  1256. false, --collisiondetection
  1257. "witchcraft_smoke.png" --texture
  1258. )
  1259. end,
  1260. })
  1261. --player effects
  1262. local register_effect = playereffects.register_effect_type
  1263. if minetest.get_modpath("player_monoids") then
  1264. local speed = player_monoids.speed
  1265. local jump = player_monoids.jump
  1266. local gravity = player_monoids.gravity
  1267. register_effect("witchcraft:potion_speed_lv1", "High Speed", nil,
  1268. {"witchcraft:potion_speed_lv1"},
  1269. function(player)
  1270. speed:add_change(player, 2, "witchcraft:potion_speed_lv1")
  1271. end,
  1272. function(effect, player)
  1273. speed:del_change(player, "witchcraft:potion_speed_lv1")
  1274. end,
  1275. false
  1276. )
  1277. register_effect("witchcraft:potion_speed_lv2", "High Speed", nil,
  1278. {"witchcraft:potion_speed_lv2"},
  1279. function(player)
  1280. speed:add_change(player, 2.5, "witchcraft:potion_speed_lv2")
  1281. end,
  1282. function(effect, player)
  1283. speed:del_change(player, "witchcraft:potion_speed_lv2")
  1284. end,
  1285. false
  1286. )
  1287. register_effect("witchcraft:potion_jump_lvx", "High Jump", nil,
  1288. {"witchcraft:potion_jump_lvx"},
  1289. function(player)
  1290. jump:add_change(player, 1.5, "witchcraft:potion_jump_lvx")
  1291. gravity:add_change(player, 0.8, "witchcraft:potion_jump_lvx")
  1292. end,
  1293. function(effect, player)
  1294. jump:del_change(player, "witchcraft:potion_jump_lvx")
  1295. gravity:del_change(player, "witchcraft:potion_jump_lvx")
  1296. end,
  1297. false
  1298. )
  1299. register_effect("witchcraft:potion_antigrav_lvx", "Light weight", nil,
  1300. {"witchcraft:potion_antigrav_lvx"},
  1301. function(player)
  1302. gravity:add_change(player, 0.1, "witchcraft:potion_antigrav_lvx")
  1303. end,
  1304. function(effect, player)
  1305. gravity:del_change(player, "witchcraft:potion_antigrav_lvx")
  1306. end,
  1307. false
  1308. )
  1309. register_effect("witchcraft:potion_slow_lv1", "Low Speed", nil,
  1310. {"witchcraft:potion_slow_lv1"},
  1311. function(player)
  1312. speed:add_change(player, 0.5, "witchcraft:potion_slow_lv1")
  1313. end,
  1314. function(effect, player)
  1315. speed:del_change(player, "witchcraft:potion_slow_lv1")
  1316. end,
  1317. false
  1318. )
  1319. register_effect("witchcraft:potion_slow_lv2", "Low Speed", nil,
  1320. {"witchcraft:potion_slow_lv2"},
  1321. function(player)
  1322. speed:add_change(player, 0.4, "witchcraft:potion_slow_lv2")
  1323. end,
  1324. function(effect, player)
  1325. speed:del_change(player, "witchcraft:potion_slow_lv2")
  1326. end,
  1327. false
  1328. )
  1329. register_effect("witchcraft:potion_swim_lv1", "Fast Swim", nil,
  1330. {"witchcraft:potion_swim_lv1"},
  1331. function(player)
  1332. speed:add_change(player, 3, "witchcraft:potion_swim_lv1")
  1333. end,
  1334. function(effect, player)
  1335. speed:del_change(player, "witchcraft:potion_swim_lv1")
  1336. end,
  1337. false
  1338. )
  1339. register_effect("witchcraft:potion_swim_lv2", "Dive", nil,
  1340. {"witchcraft:potion_swim_lv2"},
  1341. function(player)
  1342. speed:add_change(player, 3, "witchcraft:potion_swim_lv2")
  1343. gravity:add_change(player, 4, "witchcraft:potion_swim_lv2")
  1344. end,
  1345. function(effect, player)
  1346. speed:del_change(player, "witchcraft:potion_swim_lv2")
  1347. gravity:del_change(player, "witchcraft:potion_swim_lv2")
  1348. end,
  1349. false
  1350. )
  1351. else
  1352. local function playereffects_register(effect_id, desc, groups, spd, jmp,
  1353. grav, spd2, jmp2, grav2)
  1354. register_effect(effect_id, desc, nil, groups,
  1355. function(player)
  1356. player:set_physics_override(spd,jmp,grav)
  1357. end,
  1358. function(effect, player)
  1359. player:set_physics_override(spd2,jmp2,grav2)
  1360. end,
  1361. false
  1362. )
  1363. end
  1364. playereffects_register("witchcraft:potion_speed_lv1", "High speed",
  1365. {"speed"}, 2, nil, nil, 1, nil, nil)
  1366. playereffects_register("witchcraft:potion_speed_lv2", "High speed",
  1367. {"speed"}, 2.5, nil, nil, 1, nil, nil)
  1368. playereffects_register("witchcraft:potion_jump_lvx", "High Jump",
  1369. {"jump"}, nil, 1.5, 0.8, nil, 1, 1)
  1370. playereffects_register("witchcraft:potion_antigrav_lvx", "Light weight",
  1371. {"gravity"}, nil, nil, 0.1, nil, nil, 1)
  1372. playereffects_register("witchcraft:potion_slow_lv1", "Low speed",
  1373. {"speed"}, 0.5, nil, nil, 1, nil, nil)
  1374. playereffects_register("witchcraft:potion_slow_lv2", "Low speed",
  1375. {"speed"}, 0.4, nil, nil, 1, nil, nil)
  1376. playereffects_register("witchcraft:potion_swim_lv1", "Fast Swim",
  1377. {"swim"}, 3, nil, nil, 1, nil, nil)
  1378. playereffects_register("witchcraft:potion_swim_lv2", "Dive",
  1379. {"swim"}, 3, nil, 4, 1, nil, 1)
  1380. end
  1381. register_effect("potion_silver", "Fire resist", nil, {"fire_resist"},
  1382. function(player)
  1383. local pos = player:getpos()
  1384. local node = minetest.get_node(pos).name
  1385. if node == "default:lava_source" or node == "default:lava_flowing" or node == "fire:basic_flame" then
  1386. local hp1 = player:get_hp()
  1387. minetest.after(0.8, function()
  1388. local hp2 = player:get_hp()
  1389. local change = hp1-hp2
  1390. if change >= 0 then
  1391. player:set_hp(hp2+change)
  1392. end
  1393. end)
  1394. end
  1395. end,
  1396. nil,
  1397. nil,
  1398. nil,
  1399. 0.3
  1400. )
  1401. --splash potions
  1402. minetest.register_node("witchcraft:splash_orange", {
  1403. description = "Dragon Splash Potion",
  1404. drawtype = "plantlike",
  1405. tiles = {"witchcraft_splash_orange.png"},
  1406. wield_image = "witchcraft_splash_orange.png",
  1407. paramtype = "light",
  1408. stack_max = 1,
  1409. is_ground_content = false,
  1410. walkable = false,
  1411. selection_box = {
  1412. type = "fixed",
  1413. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1414. },
  1415. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1416. sounds = default.node_sound_glass_defaults(),
  1417. inventory_image = "witchcraft_splash_orange.png",
  1418. on_use = function(item, placer, pos)
  1419. local dir = placer:get_look_dir();
  1420. local playerpos = placer:getpos();
  1421. local vec = {x=dir.x*6,y=dir.y*3.5,z=dir.z*6}
  1422. local acc = {x=0,y=-9.8,z=0}
  1423. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+2+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:fire_splash")
  1424. obj:setvelocity(vec)
  1425. obj:setacceleration(acc)
  1426. item:take_item()
  1427. return item
  1428. end,
  1429. })
  1430. minetest.register_node("witchcraft:splash_purple", {
  1431. description = "Smokey Splash Potion",
  1432. drawtype = "plantlike",
  1433. tiles = {"witchcraft_splash_purple.png"},
  1434. wield_image = "witchcraft_splash_purple.png",
  1435. paramtype = "light",
  1436. stack_max = 1,
  1437. is_ground_content = false,
  1438. walkable = false,
  1439. selection_box = {
  1440. type = "fixed",
  1441. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1442. },
  1443. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1444. sounds = default.node_sound_glass_defaults(),
  1445. inventory_image = "witchcraft_splash_purple.png",
  1446. on_use = function(item, placer, pos)
  1447. local dir = placer:get_look_dir();
  1448. local playerpos = placer:getpos();
  1449. local vec = {x=dir.x*9,y=dir.y*3.5,z=dir.z*9}
  1450. local acc = {x=0,y=-9.8,z=0}
  1451. local obj = minetest.env:add_entity({x=playerpos.x+dir.x,y=playerpos.y+2+dir.y,z=playerpos.z+dir.z}, "witchcraft:smoke_splash")
  1452. obj:setvelocity(vec)
  1453. obj:setacceleration(acc)
  1454. item:take_item()
  1455. return item
  1456. end,
  1457. })
  1458. minetest.register_node("witchcraft:splash_red", {
  1459. description = "Healthy Splash Potion",
  1460. drawtype = "plantlike",
  1461. tiles = {"witchcraft_splash_red.png"},
  1462. wield_image = "witchcraft_splash_red.png",
  1463. paramtype = "light",
  1464. stack_max = 1,
  1465. is_ground_content = false,
  1466. walkable = false,
  1467. selection_box = {
  1468. type = "fixed",
  1469. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1470. },
  1471. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1472. sounds = default.node_sound_glass_defaults(),
  1473. inventory_image = "witchcraft_splash_red.png",
  1474. on_use = function(item, placer, pos)
  1475. local dir = placer:get_look_dir();
  1476. local playerpos = placer:getpos();
  1477. local vec = {x=dir.x*9,y=dir.y*3.5,z=dir.z*9}
  1478. local acc = {x=0,y=-9,z=0}
  1479. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*2,y=playerpos.y+2+dir.y,z=playerpos.z+dir.z*2}, "witchcraft:heal_splash")
  1480. obj:setvelocity(vec)
  1481. obj:setacceleration(acc)
  1482. item:take_item()
  1483. return item
  1484. end,
  1485. })
  1486. minetest.register_node("witchcraft:splash_green", {
  1487. description = "Volatile Splash Potion",
  1488. drawtype = "plantlike",
  1489. tiles = {"witchcraft_splash_green.png"},
  1490. wield_image = "witchcraft_splash_green.png",
  1491. paramtype = "light",
  1492. stack_max = 1,
  1493. is_ground_content = false,
  1494. walkable = false,
  1495. selection_box = {
  1496. type = "fixed",
  1497. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1498. },
  1499. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1500. sounds = default.node_sound_glass_defaults(),
  1501. inventory_image = "witchcraft_splash_green.png",
  1502. on_use = function(item, placer, pos)
  1503. local dir = placer:get_look_dir();
  1504. local playerpos = placer:getpos();
  1505. local vec = {x=dir.x*9,y=dir.y*3.5,z=dir.z*9}
  1506. local acc = {x=0,y=-9,z=0}
  1507. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*2,y=playerpos.y+2+dir.y,z=playerpos.z+dir.z*2}, "witchcraft:jump_splash")
  1508. obj:setvelocity(vec)
  1509. obj:setacceleration(acc)
  1510. item:take_item()
  1511. return item
  1512. end,
  1513. })
  1514. minetest.register_node("witchcraft:splash_cyan", {
  1515. description = "Light Splash Potion",
  1516. drawtype = "plantlike",
  1517. tiles = {"witchcraft_splash_cyan.png"},
  1518. wield_image = "witchcraft_splash_cyan.png",
  1519. paramtype = "light",
  1520. stack_max = 1,
  1521. is_ground_content = false,
  1522. walkable = false,
  1523. selection_box = {
  1524. type = "fixed",
  1525. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1526. },
  1527. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1528. sounds = default.node_sound_glass_defaults(),
  1529. inventory_image = "witchcraft_splash_cyan.png",
  1530. on_use = function(item, placer, pos)
  1531. local dir = placer:get_look_dir();
  1532. local playerpos = placer:getpos();
  1533. local vec = {x=dir.x*9,y=dir.y*3.5,z=dir.z*9}
  1534. local acc = {x=0,y=-9,z=0}
  1535. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*2,y=playerpos.y+2+dir.y,z=playerpos.z+dir.z*2}, "witchcraft:antigrav_splash")
  1536. obj:setvelocity(vec)
  1537. obj:setacceleration(acc)
  1538. item:take_item()
  1539. return item
  1540. end,
  1541. })
  1542. minetest.register_node("witchcraft:splash_redbrown", {
  1543. description = "Thick Splash Potion",
  1544. drawtype = "plantlike",
  1545. tiles = {"witchcraft_splash_redbrown.png"},
  1546. wield_image = "witchcraft_splash_redbrown.png",
  1547. paramtype = "light",
  1548. stack_max = 1,
  1549. is_ground_content = false,
  1550. walkable = false,
  1551. selection_box = {
  1552. type = "fixed",
  1553. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1554. },
  1555. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1556. sounds = default.node_sound_glass_defaults(),
  1557. inventory_image = "witchcraft_splash_redbrown.png",
  1558. on_use = function(item, placer, pos)
  1559. local dir = placer:get_look_dir();
  1560. local playerpos = placer:getpos();
  1561. local vec = {x=dir.x*9,y=dir.y*3.5,z=dir.z*9}
  1562. local acc = {x=0,y=-9,z=0}
  1563. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*2,y=playerpos.y+2+dir.y,z=playerpos.z+dir.z*2}, "witchcraft:slow_splash")
  1564. obj:setvelocity(vec)
  1565. obj:setacceleration(acc)
  1566. item:take_item()
  1567. return item
  1568. end,
  1569. })
  1570. minetest.register_node("witchcraft:splash_magenta", {
  1571. description = "Fast Splash Potion",
  1572. drawtype = "plantlike",
  1573. tiles = {"witchcraft_splash_magenta.png"},
  1574. wield_image = "witchcraft_splash_magenta.png",
  1575. paramtype = "light",
  1576. stack_max = 1,
  1577. is_ground_content = false,
  1578. walkable = false,
  1579. selection_box = {
  1580. type = "fixed",
  1581. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1582. },
  1583. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1584. sounds = default.node_sound_glass_defaults(),
  1585. inventory_image = "witchcraft_splash_magenta.png",
  1586. on_use = function(item, placer, pos)
  1587. local dir = placer:get_look_dir();
  1588. local playerpos = placer:getpos();
  1589. local vec = {x=dir.x*13,y=dir.y*2.5,z=dir.z*13}
  1590. local acc = {x=0,y=-9,z=0}
  1591. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*2,y=playerpos.y+2+dir.y,z=playerpos.z+dir.z*2}, "witchcraft:fast_splash")
  1592. obj:setvelocity(vec)
  1593. obj:setacceleration(acc)
  1594. item:take_item()
  1595. return item
  1596. end,
  1597. })
  1598. minetest.register_node("witchcraft:splash_brown", {
  1599. description = "Murky Splash Potion",
  1600. drawtype = "plantlike",
  1601. tiles = {"witchcraft_splash_brown.png"},
  1602. wield_image = "witchcraft_splash_brown.png",
  1603. paramtype = "light",
  1604. stack_max = 1,
  1605. is_ground_content = false,
  1606. walkable = false,
  1607. selection_box = {
  1608. type = "fixed",
  1609. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1610. },
  1611. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1612. sounds = default.node_sound_glass_defaults(),
  1613. inventory_image = "witchcraft_splash_brown.png",
  1614. on_use = function(item, placer, pos)
  1615. local dir = placer:get_look_dir();
  1616. local playerpos = placer:getpos();
  1617. local vec = {x=dir.x*9,y=dir.y*3.5,z=dir.z*9}
  1618. local acc = {x=0,y=-9,z=0}
  1619. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*2,y=playerpos.y+2+dir.y,z=playerpos.z+dir.z*2}, "witchcraft:murky_splash")
  1620. obj:setvelocity(vec)
  1621. obj:setacceleration(acc)
  1622. item:take_item()
  1623. return item
  1624. end,
  1625. })
  1626. minetest.register_node("witchcraft:splash_grey", {
  1627. description = "Death Splash Potion",
  1628. drawtype = "plantlike",
  1629. tiles = {"witchcraft_splash_grey.png"},
  1630. wield_image = "witchcraft_splash_grey.png",
  1631. paramtype = "light",
  1632. stack_max = 1,
  1633. is_ground_content = false,
  1634. walkable = false,
  1635. selection_box = {
  1636. type = "fixed",
  1637. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1638. },
  1639. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1640. sounds = default.node_sound_glass_defaults(),
  1641. inventory_image = "witchcraft_splash_grey.png",
  1642. on_use = function(item, placer, pos)
  1643. local dir = placer:get_look_dir();
  1644. local playerpos = placer:getpos();
  1645. local vec = {x=dir.x*9,y=dir.y*3.5,z=dir.z*9}
  1646. local acc = {x=0,y=-9,z=0}
  1647. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*2,y=playerpos.y+2+dir.y,z=playerpos.z+dir.z*2}, "witchcraft:death_splash")
  1648. obj:setvelocity(vec)
  1649. obj:setacceleration(acc)
  1650. item:take_item()
  1651. return item
  1652. end,
  1653. })
  1654. minetest.register_node("witchcraft:splash_ggreen", {
  1655. description = "Darkness Splash Potion",
  1656. drawtype = "plantlike",
  1657. tiles = {"witchcraft_splash_ggreen.png"},
  1658. wield_image = "witchcraft_splash_ggreen.png",
  1659. paramtype = "light",
  1660. stack_max = 1,
  1661. is_ground_content = false,
  1662. walkable = false,
  1663. selection_box = {
  1664. type = "fixed",
  1665. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1666. },
  1667. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1668. sounds = default.node_sound_glass_defaults(),
  1669. inventory_image = "witchcraft_splash_ggreen.png",
  1670. on_use = function(item, placer, pos)
  1671. local dir = placer:get_look_dir();
  1672. local playerpos = placer:getpos();
  1673. local vec = {x=dir.x*6,y=dir.y*3.5,z=dir.z*6}
  1674. local acc = {x=0,y=-9.8,z=0}
  1675. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+2+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:shadow_splash")
  1676. obj:setvelocity(vec)
  1677. obj:setacceleration(acc)
  1678. item:take_item()
  1679. return item
  1680. end,
  1681. })
  1682. minetest.register_node("witchcraft:splash_yellwgrn", {
  1683. description = "Dodgy Splash Potion",
  1684. drawtype = "plantlike",
  1685. tiles = {"witchcraft_splash_yellgrn.png"},
  1686. wield_image = "witchcraft_splash_yellgrn.png",
  1687. paramtype = "light",
  1688. stack_max = 1,
  1689. is_ground_content = false,
  1690. walkable = false,
  1691. selection_box = {
  1692. type = "fixed",
  1693. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1694. },
  1695. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1696. sounds = default.node_sound_glass_defaults(),
  1697. inventory_image = "witchcraft_splash_yellgrn.png",
  1698. on_use = function(item, placer, pos)
  1699. local dir = placer:get_look_dir();
  1700. local playerpos = placer:getpos();
  1701. local vec = {x=dir.x*7,y=dir.y*3.5,z=dir.z*7}
  1702. local acc = {x=0,y=-9.8,z=0}
  1703. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+2+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:tnt_splash")
  1704. obj:setvelocity(vec)
  1705. obj:setacceleration(acc)
  1706. item:take_item()
  1707. return item
  1708. end,
  1709. })
  1710. --potions (level 1 and 2)
  1711. minetest.register_node("witchcraft:potion_red", {
  1712. description = "Tasty Potion",
  1713. drawtype = "plantlike",
  1714. tiles = {"witchcraft_potion_red.png"},
  1715. wield_image = "witchcraft_potion_red.png",
  1716. paramtype = "light",
  1717. stack_max = 1,
  1718. is_ground_content = false,
  1719. walkable = false,
  1720. selection_box = {
  1721. type = "fixed",
  1722. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1723. },
  1724. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  1725. sounds = default.node_sound_glass_defaults(),
  1726. inventory_image = "witchcraft_potion_red.png",
  1727. on_use = function(itemstack, player)
  1728. local health = player:get_hp();
  1729. player:set_hp(health+20)
  1730. itemstack:replace("vessels:glass_bottle")
  1731. return itemstack
  1732. end,
  1733. })
  1734. minetest.register_node("witchcraft:potion_red_2", {
  1735. description = "Tasty Potion (lv2)",
  1736. drawtype = "plantlike",
  1737. tiles = {"witchcraft_potion_red.png^[colorize:black:50"},
  1738. wield_image = "witchcraft_potion_red.png^[colorize:black:50",
  1739. paramtype = "light",
  1740. stack_max = 1,
  1741. is_ground_content = false,
  1742. walkable = false,
  1743. selection_box = {
  1744. type = "fixed",
  1745. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1746. },
  1747. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1748. sounds = default.node_sound_glass_defaults(),
  1749. inventory_image = "witchcraft_potion_red.png^[colorize:black:50",
  1750. on_use = function(itemstack, player)
  1751. local health = player:get_hp();
  1752. player:set_hp(health+50)
  1753. itemstack:replace("vessels:glass_bottle")
  1754. return itemstack
  1755. end,
  1756. })
  1757. minetest.register_node("witchcraft:potion_darkpurple", {
  1758. description = "Shady Potion",
  1759. drawtype = "plantlike",
  1760. tiles = {"witchcraft_potion_darkpurple.png"},
  1761. paramtype = "light",
  1762. is_ground_content = false,
  1763. walkable = false,
  1764. selection_box = {
  1765. type = "fixed",
  1766. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1767. },
  1768. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  1769. sounds = default.node_sound_glass_defaults(),
  1770. stack_max = 1,
  1771. wield_image = "witchcraft_potion_darkpurple.png",
  1772. inventory_image = "witchcraft_potion_darkpurple.png",
  1773. on_use = function(itemstack, user)
  1774. --invisibility effect from invisibility potion by Tenplus1
  1775. local pos = user:getpos()
  1776. -- make player invisible
  1777. invisible(user, true)
  1778. -- play sound
  1779. minetest.sound_play("pop", {
  1780. pos = pos,
  1781. gain = 1.0,
  1782. max_hear_distance = 5
  1783. })
  1784. -- display 10 second warning
  1785. minetest.after(290, function()
  1786. if user:getpos() then
  1787. minetest.chat_send_player(user:get_player_name(),
  1788. ">>> You have 10 seconds before invisibility wears off!")
  1789. end
  1790. end)
  1791. -- make player visible 5 minutes later
  1792. minetest.after(300, function()
  1793. if user:getpos() then
  1794. -- show aready hidden player
  1795. invisible(user, nil)
  1796. -- play sound
  1797. minetest.sound_play("pop", {
  1798. pos = pos,
  1799. gain = 1.0,
  1800. max_hear_distance = 5
  1801. })
  1802. end
  1803. end)
  1804. --effect
  1805. local playerpos = user:getpos();
  1806. minetest.add_particlespawner(
  1807. 5, --amount
  1808. 0.1, --time
  1809. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  1810. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  1811. {x=-0, y=-0, z=-0}, --minvel
  1812. {x=0, y=0, z=0}, --maxvel
  1813. {x=-0.5,y=4,z=-0.5}, --minacc
  1814. {x=0.5,y=4,z=0.5}, --maxacc
  1815. 0.5, --minexptime
  1816. 1, --maxexptime
  1817. 1, --minsize
  1818. 2, --maxsize
  1819. false, --collisiondetection
  1820. "witchcraft_effect.png" --texture
  1821. )
  1822. -- take item
  1823. if not minetest.setting_getbool("creative_mode") then
  1824. itemstack:take_item()
  1825. return {name = "vessels:glass_bottle"}
  1826. end
  1827. end,
  1828. })
  1829. minetest.register_node("witchcraft:potion_darkpurple_2", {
  1830. description = "Shady Potion (lv2)",
  1831. drawtype = "plantlike",
  1832. tiles = {"witchcraft_potion_darkpurple.png^[colorize:black:50"},
  1833. is_ground_content = false,
  1834. walkable = false,
  1835. selection_box = {
  1836. type = "fixed",
  1837. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1838. },
  1839. paramtype = "light",
  1840. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1841. sounds = default.node_sound_glass_defaults(),
  1842. stack_max = 1,
  1843. wield_image = "witchcraft_potion_darkpurple.png^[colorize:black:50",
  1844. inventory_image = "witchcraft_potion_darkpurple.png^[colorize:black:50",
  1845. on_use = function(itemstack, user)
  1846. local pos = user:getpos()
  1847. -- make player invisible
  1848. invisible(user, true)
  1849. -- play sound
  1850. minetest.sound_play("pop", {
  1851. pos = pos,
  1852. gain = 1.0,
  1853. max_hear_distance = 5
  1854. })
  1855. -- display 10 second warning
  1856. minetest.after(340, function()
  1857. if user:getpos() then
  1858. minetest.chat_send_player(user:get_player_name(),
  1859. ">>> You have 10 seconds before invisibility wears off!")
  1860. end
  1861. end)
  1862. -- make player visible 5 minutes later
  1863. minetest.after(350, function()
  1864. if user:getpos() then
  1865. -- show aready hidden player
  1866. invisible(user, nil)
  1867. -- play sound
  1868. minetest.sound_play("pop", {
  1869. pos = pos,
  1870. gain = 1.0,
  1871. max_hear_distance = 5
  1872. })
  1873. end
  1874. end)
  1875. --effect
  1876. local playerpos = user:getpos();
  1877. minetest.add_particlespawner(
  1878. 5, --amount
  1879. 0.1, --time
  1880. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  1881. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  1882. {x=-0, y=-0, z=-0}, --minvel
  1883. {x=0, y=0, z=0}, --maxvel
  1884. {x=-0.5,y=4,z=-0.5}, --minacc
  1885. {x=0.5,y=4,z=0.5}, --maxacc
  1886. 0.5, --minexptime
  1887. 1, --maxexptime
  1888. 1, --minsize
  1889. 2, --maxsize
  1890. false, --collisiondetection
  1891. "witchcraft_effect.png" --texture
  1892. )
  1893. -- take item
  1894. if not minetest.setting_getbool("creative_mode") then
  1895. itemstack:take_item()
  1896. return {name = "vessels:glass_bottle"}
  1897. end
  1898. end,
  1899. })
  1900. minetest.register_node("witchcraft:potion_brown", {
  1901. description = "Murky Potion",
  1902. drawtype = "plantlike",
  1903. tiles = {"witchcraft_potion_brown.png"},
  1904. wield_image = "witchcraft_potion_brown.png",
  1905. paramtype = "light",
  1906. stack_max = 1,
  1907. is_ground_content = false,
  1908. walkable = false,
  1909. selection_box = {
  1910. type = "fixed",
  1911. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1912. },
  1913. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  1914. sounds = default.node_sound_glass_defaults(),
  1915. inventory_image = "witchcraft_potion_brown.png",
  1916. on_use = minetest.item_eat(-5, "vessels:glass_bottle"),
  1917. })
  1918. minetest.register_node("witchcraft:potion_brown_2", {
  1919. description = "Murky Potion (lv2)",
  1920. drawtype = "plantlike",
  1921. tiles = {"witchcraft_potion_brown.png^[colorize:black:50"},
  1922. wield_image = "witchcraft_potion_brown.png^[colorize:black:50",
  1923. paramtype = "light",
  1924. stack_max = 1,
  1925. is_ground_content = false,
  1926. walkable = false,
  1927. selection_box = {
  1928. type = "fixed",
  1929. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1930. },
  1931. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1932. sounds = default.node_sound_glass_defaults(),
  1933. inventory_image = "witchcraft_potion_brown.png^[colorize:black:50",
  1934. on_use = minetest.item_eat(-10, "vessels:glass_bottle"),
  1935. })
  1936. --cannot get the potion to be removed from inventory on use?
  1937. minetest.register_node("witchcraft:potion_yllwgrn", {
  1938. description = "Dodgy Potion",
  1939. drawtype = "plantlike",
  1940. tiles = {"witchcraft_potion_yellgrn.png"},
  1941. wield_image = "witchcraft_potion_yellgrn.png",
  1942. paramtype = "light",
  1943. stack_max = 1,
  1944. is_ground_content = false,
  1945. walkable = false,
  1946. selection_box = {
  1947. type = "fixed",
  1948. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1949. },
  1950. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  1951. sounds = default.node_sound_glass_defaults(),
  1952. inventory_image = "witchcraft_potion_yellgrn.png",
  1953. on_use = function(pos, placer, itemstack)
  1954. local pos = placer:getpos();
  1955. tnt.boom(pos, {damage_radius=5,radius=3,ignore_protection=false})
  1956. return itemstack
  1957. end,
  1958. })
  1959. minetest.register_node("witchcraft:potion_yllwgrn_2", {
  1960. description = "Dodgy Potion (lv2)",
  1961. drawtype = "plantlike",
  1962. tiles = {"witchcraft_potion_yellgrn.png^[colorize:black:50"},
  1963. wield_image = "witchcraft_potion_yellgrn.png^[colorize:black:50",
  1964. paramtype = "light",
  1965. stack_max = 1,
  1966. is_ground_content = false,
  1967. walkable = false,
  1968. selection_box = {
  1969. type = "fixed",
  1970. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  1971. },
  1972. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  1973. sounds = default.node_sound_glass_defaults(),
  1974. inventory_image = "witchcraft_potion_yellgrn.png^[colorize:black:50",
  1975. on_use = function(pos, placer, itemstack)
  1976. local pos = placer:getpos();
  1977. tnt.boom(pos, {damage_radius=10,radius=4,ignore_protection=false})
  1978. return itemstack
  1979. end,
  1980. })
  1981. minetest.register_entity("witchcraft:fire", {
  1982. textures = {"witchcraft_flame.png"},
  1983. velocity = 0.1,
  1984. damage = 2,
  1985. collisionbox = {0, 0, 0, 0, 0, 0},
  1986. on_step = function(self, obj, pos)
  1987. local remove = minetest.after(2, function()
  1988. self.object:remove()
  1989. end)
  1990. local pos = self.object:getpos()
  1991. local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
  1992. for k, obj in pairs(objs) do
  1993. if obj:get_luaentity() ~= nil then
  1994. if obj:get_luaentity().name ~= "witchcraft:fire" and obj:get_luaentity().name ~= "__builtin:item" then
  1995. obj:punch(self.object, 1.0, {
  1996. full_punch_interval=1.0,
  1997. damage_groups={fleshy=3},
  1998. }, nil)
  1999. self.object:remove()
  2000. end
  2001. end
  2002. end
  2003. for dx=0,1 do
  2004. for dy=0,1 do
  2005. for dz=0,1 do
  2006. local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
  2007. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  2008. local n = minetest.env:get_node(p).name
  2009. if n ~= "witchcraft:fire" and n ~= "air" and n ~="default:dirt_with_grass" and n ~="default:dirt_with_dry_grass" and n ~="default:stone" then
  2010. minetest.env:set_node(t, {name="fire:basic_flame"})
  2011. elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
  2012. self.object:remove()
  2013. return
  2014. end
  2015. end
  2016. end
  2017. end
  2018. hit_node = function(self, pos, node)
  2019. local pos = self.object:getpos()
  2020. for dx=-4,4 do
  2021. for dy=-4,4 do
  2022. for dz=-4,4 do
  2023. local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  2024. local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
  2025. local n = minetest.env:get_node(pos).name
  2026. if math.random(1, 50) <= 35 then
  2027. minetest.env:remove_node(p)
  2028. end
  2029. if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <=5 then
  2030. minetest.env:set_node(t, {name="fire:basic_flame"})
  2031. end
  2032. end
  2033. end
  2034. end
  2035. end
  2036. local apos = self.object:getpos()
  2037. local part = minetest.add_particlespawner(
  2038. 10, --amount
  2039. 0.3, --time
  2040. {x=apos.x-0.3, y=apos.y-0.3, z=apos.z-0.3}, --minpos
  2041. {x=apos.x+0.3, y=apos.y+0.3, z=apos.z+0.3}, --maxpos
  2042. {x=-0, y=-0, z=-0}, --minvel
  2043. {x=0, y=0, z=0}, --maxvel
  2044. {x=0,y=-0.5,z=0}, --minacc
  2045. {x=0.5,y=0.5,z=0.5}, --maxacc
  2046. 1, --minexptime
  2047. 1, --maxexptime
  2048. 1, --minsize
  2049. 2, --maxsize
  2050. false, --collisiondetection
  2051. "witchcraft_flame.png" --texture
  2052. )
  2053. end,
  2054. })
  2055. minetest.register_node("witchcraft:potion_orange", {
  2056. description = "Dragon Potion",
  2057. drawtype = "plantlike",
  2058. tiles = {"witchcraft_potion_orange.png"},
  2059. wield_image = "witchcraft_potion_orange.png",
  2060. paramtype = "light",
  2061. stack_max = 1,
  2062. is_ground_content = false,
  2063. walkable = false,
  2064. selection_box = {
  2065. type = "fixed",
  2066. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2067. },
  2068. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  2069. sounds = default.node_sound_glass_defaults(),
  2070. inventory_image = "witchcraft_potion_orange.png",
  2071. on_use = function(item, placer, pos)
  2072. local dir = placer:get_look_dir();
  2073. local playerpos = placer:getpos();
  2074. local vec = {x=dir.x*2,y=dir.y*2.5,z=dir.z*2}
  2075. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:fire")
  2076. obj:setvelocity(vec)
  2077. local part = minetest.add_particlespawner(
  2078. 10, --amount
  2079. 0.3, --time
  2080. {x=playerpos.x-0.3, y=playerpos.y+1.5, z=playerpos.z-0.3}, --minpos
  2081. {x=playerpos.x+0.3, y=playerpos.y+1.5, z=playerpos.z+0.3}, --maxpos
  2082. {x=dir.x*3,y=dir.y*3,z=dir.z*3}, --minvel
  2083. {x=dir.x*3,y=dir.y*3,z=dir.z*3}, --maxvel
  2084. {x=0,y=-0.5,z=0}, --minacc
  2085. {x=0.5,y=0.5,z=0.5}, --maxacc
  2086. 1, --minexptime
  2087. 2, --maxexptime
  2088. 1, --minsize
  2089. 2, --maxsize
  2090. false, --collisiondetection
  2091. "witchcraft_flame.png" --texture
  2092. )
  2093. item:replace("vessels:glass_bottle")
  2094. return item
  2095. end,
  2096. })
  2097. minetest.register_node("witchcraft:potion_orange_2", {
  2098. description = "Dragon Potion (v2)",
  2099. drawtype = "plantlike",
  2100. tiles = {"witchcraft_potion_orange.png^[colorize:black:50"},
  2101. wield_image = "witchcraft_potion_orange.png^[colorize:black:50",
  2102. paramtype = "light",
  2103. stack_max = 1,
  2104. is_ground_content = false,
  2105. walkable = false,
  2106. selection_box = {
  2107. type = "fixed",
  2108. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2109. },
  2110. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2111. sounds = default.node_sound_glass_defaults(),
  2112. inventory_image = "witchcraft_potion_orange.png^[colorize:black:50",
  2113. on_use = function(item, placer, pos)
  2114. local dir = placer:get_look_dir();
  2115. local playerpos = placer:getpos();
  2116. local vec = {x=dir.x*3,y=dir.y*3.5,z=dir.z*3}
  2117. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:fire")
  2118. obj:setvelocity(vec)
  2119. local part = minetest.add_particlespawner(
  2120. 10, --amount
  2121. 0.3, --time
  2122. {x=playerpos.x-0.3, y=playerpos.y+1.5, z=playerpos.z-0.3}, --minpos
  2123. {x=playerpos.x+0.3, y=playerpos.y+1.5, z=playerpos.z+0.3}, --maxpos
  2124. {x=dir.x*3,y=dir.y*3,z=dir.z*3}, --minvel
  2125. {x=dir.x*3,y=dir.y*3,z=dir.z*3}, --maxvel
  2126. {x=0,y=-0.5,z=0}, --minacc
  2127. {x=0.5,y=0.5,z=0.5}, --maxacc
  2128. 1, --minexptime
  2129. 2, --maxexptime
  2130. 1, --minsize
  2131. 2, --maxsize
  2132. false, --collisiondetection
  2133. "witchcraft_flame.png^[colorize:blue:200" --texture
  2134. )
  2135. item:replace("vessels:glass_bottle")
  2136. return item
  2137. end,
  2138. })
  2139. minetest.register_node("witchcraft:splash_orange", {
  2140. description = "Dragon Splash Potion",
  2141. drawtype = "plantlike",
  2142. tiles = {"witchcraft_splash_orange.png"},
  2143. wield_image = "witchcraft_splash_orange.png",
  2144. paramtype = "light",
  2145. stack_max = 1,
  2146. is_ground_content = false,
  2147. walkable = false,
  2148. selection_box = {
  2149. type = "fixed",
  2150. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2151. },
  2152. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2153. sounds = default.node_sound_glass_defaults(),
  2154. inventory_image = "witchcraft_splash_orange.png",
  2155. on_use = function(item, placer, pos)
  2156. local dir = placer:get_look_dir();
  2157. local playerpos = placer:getpos();
  2158. local vec = {x=dir.x*6,y=dir.y*3.5,z=dir.z*6}
  2159. local acc = {x=0,y=-9.8,z=0}
  2160. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+2+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:fire_splash")
  2161. obj:setvelocity(vec)
  2162. obj:setacceleration(acc)
  2163. item:take_item()
  2164. return item
  2165. end,
  2166. })
  2167. minetest.register_node("witchcraft:splash_yellwgrn", {
  2168. description = "Dodgy Splash Potion",
  2169. drawtype = "plantlike",
  2170. tiles = {"witchcraft_splash_yellgrn.png"},
  2171. wield_image = "witchcraft_splash_yellgrn.png",
  2172. paramtype = "light",
  2173. stack_max = 1,
  2174. is_ground_content = false,
  2175. walkable = false,
  2176. selection_box = {
  2177. type = "fixed",
  2178. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2179. },
  2180. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2181. sounds = default.node_sound_glass_defaults(),
  2182. inventory_image = "witchcraft_splash_yellgrn.png",
  2183. on_use = function(item, placer, pos)
  2184. local dir = placer:get_look_dir();
  2185. local playerpos = placer:getpos();
  2186. local vec = {x=dir.x*7,y=dir.y*3.5,z=dir.z*7}
  2187. local acc = {x=0,y=-9.8,z=0}
  2188. local obj = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+2+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:tnt_splash")
  2189. obj:setvelocity(vec)
  2190. obj:setacceleration(acc)
  2191. item:take_item()
  2192. return item
  2193. end,
  2194. })
  2195. minetest.register_node("witchcraft:potion_purple", {
  2196. description = "Smokey Potion",
  2197. drawtype = "plantlike",
  2198. tiles = {"witchcraft_potion_purple.png"},
  2199. wield_image = "witchcraft_potion_purple.png",
  2200. paramtype = "light",
  2201. stack_max = 1,
  2202. is_ground_content = false,
  2203. walkable = false,
  2204. selection_box = {
  2205. type = "fixed",
  2206. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2207. },
  2208. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  2209. sounds = default.node_sound_glass_defaults(),
  2210. inventory_image = "witchcraft_potion_purple.png",
  2211. on_use = function(item, placer, pos)
  2212. local dir = placer:get_look_dir();
  2213. local playerpos = placer:getpos();
  2214. local vec = {x=dir.x*2,y=dir.y*2.5,z=dir.z*2}
  2215. local part = minetest.add_particlespawner(
  2216. 20, --amount
  2217. 0.5, --time
  2218. {x=playerpos.x-1, y=playerpos.y, z=playerpos.z-1}, --minpos
  2219. {x=playerpos.x+1, y=playerpos.y, z=playerpos.z+1}, --maxpos
  2220. {x=0,y=0.5,z=0}, --minvel
  2221. {x=0,y=0.6,z=0}, --maxvel
  2222. {x=0,y=-0.5,z=0}, --minacc
  2223. {x=0,y=0.5,z=0}, --maxacc
  2224. 1, --minexptime
  2225. 3, --maxexptime
  2226. 10, --minsize
  2227. 15, --maxsize
  2228. false, --collisiondetection
  2229. "witchcraft_smoke.png^[colorize:magenta:50" --texture
  2230. )
  2231. item:replace("vessels:glass_bottle")
  2232. return item
  2233. end,
  2234. })
  2235. minetest.register_node("witchcraft:potion_gpurple", {
  2236. description = "Filling Potion",
  2237. drawtype = "plantlike",
  2238. tiles = {"witchcraft_potion_gpurple.png"},
  2239. wield_image = "witchcraft_potion_gpurple.png",
  2240. paramtype = "light",
  2241. stack_max = 1,
  2242. is_ground_content = false,
  2243. walkable = false,
  2244. selection_box = {
  2245. type = "fixed",
  2246. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2247. },
  2248. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2249. sounds = default.node_sound_glass_defaults(),
  2250. inventory_image = "witchcraft_potion_gpurple.png",
  2251. on_use = minetest.item_eat(20, "vessels:glass_bottle"),
  2252. })
  2253. minetest.register_node("witchcraft:potion_gred", {
  2254. description = "Hunger Potion",
  2255. drawtype = "plantlike",
  2256. tiles = {"witchcraft_potion_gred.png"},
  2257. wield_image = "witchcraft_potion_gred.png",
  2258. paramtype = "light",
  2259. stack_max = 1,
  2260. is_ground_content = false,
  2261. walkable = false,
  2262. selection_box = {
  2263. type = "fixed",
  2264. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2265. },
  2266. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2267. sounds = default.node_sound_glass_defaults(),
  2268. inventory_image = "witchcraft_potion_gred.png",
  2269. on_use = minetest.item_eat(-10, "vessels:glass_bottle"),
  2270. })
  2271. minetest.register_node("witchcraft:potion_purple_2", {
  2272. description = "Smokey Potion (lv2)",
  2273. drawtype = "plantlike",
  2274. tiles = {"witchcraft_potion_purple.png^[colorize:black:50"},
  2275. wield_image = "witchcraft_potion_purple.png^[colorize:black:50",
  2276. paramtype = "light",
  2277. stack_max = 1,
  2278. is_ground_content = false,
  2279. walkable = false,
  2280. selection_box = {
  2281. type = "fixed",
  2282. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2283. },
  2284. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2285. sounds = default.node_sound_glass_defaults(),
  2286. inventory_image = "witchcraft_potion_purple.png^[colorize:black:20",
  2287. on_use = function(item, placer, pos)
  2288. local dir = placer:get_look_dir();
  2289. local playerpos = placer:getpos();
  2290. local vec = {x=dir.x*2,y=dir.y*2.5,z=dir.z*2}
  2291. local part = minetest.add_particlespawner(
  2292. 20, --amount
  2293. 0.5, --time
  2294. {x=playerpos.x-1, y=playerpos.y, z=playerpos.z-1}, --minpos
  2295. {x=playerpos.x+1, y=playerpos.y, z=playerpos.z+1}, --maxpos
  2296. {x=0,y=0.2,z=0}, --minvel
  2297. {x=0,y=0.2,z=0}, --maxvel
  2298. {x=0,y=-0.1,z=0}, --minacc
  2299. {x=0,y=0.1,z=0}, --maxacc
  2300. 5, --minexptime
  2301. 10, --maxexptime
  2302. 10, --minsize
  2303. 15, --maxsize
  2304. false, --collisiondetection
  2305. "witchcraft_smoke.png^[colorize:magenta:50" --texture
  2306. )
  2307. item:replace("vessels:glass_bottle")
  2308. return item
  2309. end,
  2310. })
  2311. minetest.register_node("witchcraft:potion_grey", {
  2312. description = "Evil Potion",
  2313. drawtype = "plantlike",
  2314. stack_max = 1,
  2315. tiles = {"witchcraft_potion_grey.png"},
  2316. wield_image = "witchcraft_potion_grey.png",
  2317. paramtype = "light",
  2318. is_ground_content = false,
  2319. walkable = false,
  2320. selection_box = {
  2321. type = "fixed",
  2322. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2323. },
  2324. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  2325. sounds = default.node_sound_glass_defaults(),
  2326. inventory_image = "witchcraft_potion_grey.png",
  2327. on_use = minetest.item_eat(-100, "vessels:glass_bottle"),
  2328. })
  2329. minetest.register_node("witchcraft:potion_grey_2", {
  2330. description = "Evil Potion (lv2)",
  2331. drawtype = "plantlike",
  2332. stack_max = 1,
  2333. tiles = {"witchcraft_potion_grey.png^[colorize:black:50"},
  2334. wield_image = "witchcraft_potion_grey.png^[colorize:black:50",
  2335. paramtype = "light",
  2336. is_ground_content = false,
  2337. walkable = false,
  2338. selection_box = {
  2339. type = "fixed",
  2340. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2341. },
  2342. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2343. sounds = default.node_sound_glass_defaults(),
  2344. inventory_image = "witchcraft_potion_grey.png^[colorize:black:50",
  2345. on_use = minetest.item_eat(-200, "vessels:glass_bottle"),
  2346. })
  2347. minetest.register_node("witchcraft:potion_blue", {
  2348. description = "Bottle of Water",
  2349. drawtype = "plantlike",
  2350. tiles = {"witchcraft_potion_blue.png"},
  2351. wield_image = "witchcraft_potion_blue.png",
  2352. paramtype = "light",
  2353. stack_max = 1,
  2354. is_ground_content = false,
  2355. walkable = false,
  2356. selection_box = {
  2357. type = "fixed",
  2358. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2359. },
  2360. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2361. sounds = default.node_sound_glass_defaults(),
  2362. inventory_image = "witchcraft_potion_blue.png",
  2363. on_use = function(item, user, pointed_thing)
  2364. local player = user:get_player_name()
  2365. if pointed_thing.type == "node" and
  2366. minetest.get_node(pointed_thing.above).name == "air" then
  2367. if not minetest.is_protected(pointed_thing.above, player) then
  2368. minetest.set_node(pointed_thing.above, {name="default:water_source"})
  2369. else
  2370. minetest.chat_send_player(player, "This area is protected.")
  2371. end
  2372. end
  2373. item:replace("vessels:glass_bottle")
  2374. return item
  2375. end
  2376. })
  2377. minetest.register_node("witchcraft:potion_silver", {
  2378. description = "Cold potion",
  2379. drawtype = "plantlike",
  2380. tiles = {"witchcraft_potion_silver.png"},
  2381. wield_image = "witchcraft_potion_silver.png",
  2382. paramtype = "light",
  2383. stack_max = 1,
  2384. is_ground_content = false,
  2385. walkable = false,
  2386. selection_box = {
  2387. type = "fixed",
  2388. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2389. },
  2390. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2391. sounds = default.node_sound_glass_defaults(),
  2392. inventory_image = "witchcraft_potion_silver.png",
  2393. on_use = function(item, user, pointed_thing)
  2394. playereffects.apply_effect_type("potion_silver", 15, user)
  2395. item:replace("vessels:glass_bottle")
  2396. return item
  2397. end
  2398. })
  2399. minetest.register_node("witchcraft:potion_silver_2", {
  2400. description = "Cold potion lv2",
  2401. drawtype = "plantlike",
  2402. tiles = {"witchcraft_potion_silver.png^[colorize:black:50"},
  2403. wield_image = "witchcraft_potion_silver.png^[colorize:black:50",
  2404. paramtype = "light",
  2405. stack_max = 1,
  2406. is_ground_content = false,
  2407. walkable = false,
  2408. selection_box = {
  2409. type = "fixed",
  2410. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2411. },
  2412. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2413. sounds = default.node_sound_glass_defaults(),
  2414. inventory_image = "witchcraft_potion_silver.png^[colorize:black:50",
  2415. on_use = function(item, user, pointed_thing)
  2416. playereffects.apply_effect_type("potion_silver", 60, user)
  2417. item:replace("vessels:glass_bottle")
  2418. return item
  2419. end
  2420. })
  2421. -- farming redo support
  2422. local plant_desc
  2423. local plant_act
  2424. if farming.mod and farming.mod == "redo" then
  2425. plant_desc = "Melon Potion"
  2426. function plant_act (pointed_thing)
  2427. minetest.set_node(pointed_thing, {name="farming:melon_8"})
  2428. end
  2429. else
  2430. plant_desc = "Plant Potion (destructive!)"
  2431. function plant_act (pointed_thing)
  2432. default.grow_new_jungle_tree(pointed_thing)
  2433. end
  2434. end
  2435. minetest.register_node("witchcraft:potion_green", {
  2436. description = plant_desc,
  2437. drawtype = "plantlike",
  2438. tiles = {"witchcraft_potion_green.png"},
  2439. wield_image = "witchcraft_potion_green.png",
  2440. paramtype = "light",
  2441. stack_max = 1,
  2442. is_ground_content = false,
  2443. walkable = false,
  2444. selection_box = {
  2445. type = "fixed",
  2446. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2447. },
  2448. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2449. sounds = default.node_sound_glass_defaults(),
  2450. inventory_image = "witchcraft_potion_green.png",
  2451. on_use = function(item, user, pointed_thing)
  2452. local player = user:get_player_name()
  2453. if pointed_thing.type == "node" and
  2454. minetest.get_node(pointed_thing.above).name == "air" then
  2455. if not minetest.is_protected(pointed_thing.above, player) then
  2456. plant_act(pointed_thing.above)
  2457. else
  2458. minetest.chat_send_player(player, "This area is protected.")
  2459. end
  2460. end
  2461. local playerpos = user:getpos();
  2462. minetest.add_particlespawner(
  2463. 5, --amount
  2464. 0.1, --time
  2465. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  2466. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  2467. {x=-0, y=-0, z=-0}, --minvel
  2468. {x=0, y=0, z=0}, --maxvel
  2469. {x=-0.5,y=4,z=-0.5}, --minacc
  2470. {x=0.5,y=4,z=0.5}, --maxacc
  2471. 0.5, --minexptime
  2472. 1, --maxexptime
  2473. 1, --minsize
  2474. 2, --maxsize
  2475. false, --collisiondetection
  2476. "witchcraft_effect.png" --texture
  2477. )
  2478. item:replace("vessels:glass_bottle")
  2479. return item
  2480. end
  2481. })
  2482. minetest.register_node("witchcraft:potion_gold", {
  2483. description = "Alchemy Potion",
  2484. drawtype = "plantlike",
  2485. tiles = {"witchcraft_potion_gold.png"},
  2486. wield_image = "witchcraft_potion_gold.png",
  2487. paramtype = "light",
  2488. stack_max = 1,
  2489. is_ground_content = false,
  2490. walkable = false,
  2491. selection_box = {
  2492. type = "fixed",
  2493. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2494. },
  2495. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  2496. sounds = default.node_sound_glass_defaults(),
  2497. inventory_image = "witchcraft_potion_gold.png",
  2498. on_use = function(item, user, pointed_thing)
  2499. local player = user:get_player_name()
  2500. if pointed_thing.type == "node" and
  2501. minetest.get_node(pointed_thing.above).name == "air" then
  2502. if not minetest.is_protected(pointed_thing.above, player) then
  2503. minetest.set_node(pointed_thing.above, {name="default:goldblock"})
  2504. else
  2505. minetest.chat_send_player(player, "This area is protected.")
  2506. end
  2507. end
  2508. local playerpos = user:getpos();
  2509. minetest.add_particlespawner(
  2510. 5, --amount
  2511. 0.1, --time
  2512. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  2513. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  2514. {x=-0, y=-0, z=-0}, --minvel
  2515. {x=0, y=0, z=0}, --maxvel
  2516. {x=-0.5,y=4,z=-0.5}, --minacc
  2517. {x=0.5,y=4,z=0.5}, --maxacc
  2518. 0.5, --minexptime
  2519. 1, --maxexptime
  2520. 1, --minsize
  2521. 2, --maxsize
  2522. false, --collisiondetection
  2523. "witchcraft_effect.png" --texture
  2524. )
  2525. item:replace("vessels:glass_bottle")
  2526. return item
  2527. end
  2528. })
  2529. minetest.register_node("witchcraft:potion_gold_2", {
  2530. description = "Alchemy Potion (lv2)",
  2531. drawtype = "plantlike",
  2532. tiles = {"witchcraft_potion_gold.png^[colorize:black:50"},
  2533. wield_image = "witchcraft_potion_gold.png^[colorize:black:50",
  2534. paramtype = "light",
  2535. stack_max = 1,
  2536. is_ground_content = false,
  2537. walkable = false,
  2538. selection_box = {
  2539. type = "fixed",
  2540. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2541. },
  2542. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2543. sounds = default.node_sound_glass_defaults(),
  2544. inventory_image = "witchcraft_potion_gold.png^[colorize:black:50",
  2545. on_use = function(item, user, pointed_thing)
  2546. local player = user:get_player_name()
  2547. if pointed_thing.type == "node" and
  2548. minetest.get_node(pointed_thing.above).name == "air" then
  2549. if not minetest.is_protected(pointed_thing.above, player) then
  2550. minetest.set_node(pointed_thing.above, {name="default:diamondblock"})
  2551. else
  2552. minetest.chat_send_player(player, "This area is protected.")
  2553. end
  2554. end
  2555. local playerpos = user:getpos();
  2556. minetest.add_particlespawner(
  2557. 5, --amount
  2558. 0.1, --time
  2559. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  2560. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  2561. {x=-0, y=-0, z=-0}, --minvel
  2562. {x=0, y=0, z=0}, --maxvel
  2563. {x=-0.5,y=4,z=-0.5}, --minacc
  2564. {x=0.5,y=4,z=0.5}, --maxacc
  2565. 0.5, --minexptime
  2566. 1, --maxexptime
  2567. 1, --minsize
  2568. 2, --maxsize
  2569. false, --collisiondetection
  2570. "witchcraft_effect.png" --texture
  2571. )
  2572. item:replace("vessels:glass_bottle")
  2573. return item
  2574. end
  2575. })
  2576. if minetest.get_modpath("experience") then
  2577. minetest.register_node("witchcraft:potion_aqua", {
  2578. description = "Complex Potion",
  2579. drawtype = "plantlike",
  2580. tiles = {"witchcraft_potion_aqua.png"},
  2581. wield_image = "witchcraft_potion_aqua.png",
  2582. paramtype = "light",
  2583. stack_max = 1,
  2584. is_ground_content = false,
  2585. walkable = false,
  2586. selection_box = {
  2587. type = "fixed",
  2588. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2589. },
  2590. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2591. sounds = default.node_sound_glass_defaults(),
  2592. inventory_image = "witchcraft_potion_aqua.png",
  2593. on_use = function(item, placer, pos)
  2594. local pos = placer:getpos();
  2595. minetest.add_particlespawner(
  2596. 6, --amount
  2597. 0.1, --time
  2598. {x=pos.x-1, y=pos.y+0.5, z=pos.z-1}, --minpos
  2599. {x=pos.x+1, y=pos.y+1, z=pos.z+1}, --maxpos
  2600. {x=-0, y=-0, z=-0}, --minvel
  2601. {x=0, y=0, z=0}, --maxvel
  2602. {x=-0.5,y=2,z=-0.5}, --minacc
  2603. {x=0.5,y=2,z=0.5}, --maxacc
  2604. 0.5, --minexptime
  2605. 1, --maxexptime
  2606. 1, --minsize
  2607. 2, --maxsize
  2608. false, --collisiondetection
  2609. "orb.png" --texture
  2610. )
  2611. minetest.env:add_entity(pos, "experience:orb")
  2612. minetest.env:add_entity(pos, "experience:orb")
  2613. minetest.env:add_entity(pos, "experience:orb")
  2614. minetest.env:add_entity(pos, "experience:orb")
  2615. minetest.env:add_entity(pos, "experience:orb")
  2616. item:replace("vessels:glass_bottle")
  2617. return item
  2618. end
  2619. })
  2620. else
  2621. minetest.register_node("witchcraft:potion_aqua", {
  2622. description = "Complex Potion",
  2623. drawtype = "plantlike",
  2624. tiles = {"witchcraft_potion_aqua.png"},
  2625. wield_image = "witchcraft_potion_aqua.png",
  2626. paramtype = "light",
  2627. stack_max = 1,
  2628. is_ground_content = false,
  2629. walkable = false,
  2630. selection_box = {
  2631. type = "fixed",
  2632. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2633. },
  2634. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2635. sounds = default.node_sound_glass_defaults(),
  2636. inventory_image = "witchcraft_potion_aqua.png",
  2637. on_use = function(item, placer, pos)
  2638. local pos = placer:getpos();
  2639. minetest.add_particlespawner(
  2640. 6, --amount
  2641. 0.1, --time
  2642. {x=pos.x-1, y=pos.y+0.5, z=pos.z-1}, --minpos
  2643. {x=pos.x+1, y=pos.y+1, z=pos.z+1}, --maxpos
  2644. {x=-0, y=-0, z=-0}, --minvel
  2645. {x=0, y=0, z=0}, --maxvel
  2646. {x=-0.5,y=2,z=-0.5}, --minacc
  2647. {x=0.5,y=2,z=0.5}, --maxacc
  2648. 0.5, --minexptime
  2649. 1, --maxexptime
  2650. 1, --minsize
  2651. 2, --maxsize
  2652. false, --collisiondetection
  2653. "witchcraft_effect.png" --texture
  2654. )
  2655. minetest.add_item(pos, "default:steel_ingot")
  2656. minetest.add_item(pos, "witchcraft:herb")
  2657. minetest.add_item(pos, "default:mese_crystal")
  2658. minetest.add_item(pos, "default:gold_lump")
  2659. minetest.add_item(pos, "farming:bread")
  2660. minetest.add_item(pos, "default:copper_ingot")
  2661. item:replace("vessels:glass_bottle")
  2662. return item
  2663. end
  2664. })
  2665. end
  2666. minetest.register_node("witchcraft:potion_magenta", {
  2667. description = "Fast Potion",
  2668. drawtype = "plantlike",
  2669. tiles = {"witchcraft_potion_magenta.png"},
  2670. wield_image = "witchcraft_potion_magenta.png",
  2671. paramtype = "light",
  2672. stack_max = 1,
  2673. is_ground_content = false,
  2674. walkable = false,
  2675. selection_box = {
  2676. type = "fixed",
  2677. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2678. },
  2679. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  2680. sounds = default.node_sound_glass_defaults(),
  2681. inventory_image = "witchcraft_potion_magenta.png",
  2682. on_use = function(item, user, pointed_thing)
  2683. local player = user:get_player_name()
  2684. local breath_change = user:set_breath(5)
  2685. playereffects.apply_effect_type("witchcraft:potion_speed_lv1", 10, user)
  2686. local playerpos = user:getpos();
  2687. minetest.add_particlespawner(
  2688. 5, --amount
  2689. 0.1, --time
  2690. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  2691. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  2692. {x=-0, y=-0, z=-0}, --minvel
  2693. {x=0, y=0, z=0}, --maxvel
  2694. {x=-0.5,y=4,z=-0.5}, --minacc
  2695. {x=0.5,y=4,z=0.5}, --maxacc
  2696. 0.5, --minexptime
  2697. 1, --maxexptime
  2698. 1, --minsize
  2699. 2, --maxsize
  2700. false, --collisiondetection
  2701. "witchcraft_effect.png" --texture
  2702. )
  2703. item:replace("vessels:glass_bottle")
  2704. return item
  2705. end
  2706. })
  2707. minetest.register_node("witchcraft:potion_magenta_2", {
  2708. description = "Fast Potion (lv2)",
  2709. drawtype = "plantlike",
  2710. tiles = {"witchcraft_potion_magenta.png^[colorize:black:50"},
  2711. wield_image = "witchcraft_potion_magenta.png^[colorize:black:50",
  2712. paramtype = "light",
  2713. stack_max = 1,
  2714. is_ground_content = false,
  2715. walkable = false,
  2716. selection_box = {
  2717. type = "fixed",
  2718. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2719. },
  2720. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2721. sounds = default.node_sound_glass_defaults(),
  2722. inventory_image = "witchcraft_potion_magenta.png^[colorize:black:50",
  2723. on_use = function(item, user, pointed_thing)
  2724. local player = user:get_player_name()
  2725. local breath_change = user:set_breath(5)
  2726. playereffects.apply_effect_type("witchcraft:potion_speed_lv2", 10, user)
  2727. local playerpos = user:getpos();
  2728. minetest.add_particlespawner(
  2729. 5, --amount
  2730. 0.1, --time
  2731. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  2732. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  2733. {x=-0, y=-0, z=-0}, --minvel
  2734. {x=0, y=0, z=0}, --maxvel
  2735. {x=-0.5,y=4,z=-0.5}, --minacc
  2736. {x=0.5,y=4,z=0.5}, --maxacc
  2737. 0.5, --minexptime
  2738. 1, --maxexptime
  2739. 1, --minsize
  2740. 2, --maxsize
  2741. false, --collisiondetection
  2742. "witchcraft_effect.png" --texture
  2743. )
  2744. item:replace("vessels:glass_bottle")
  2745. return item
  2746. end
  2747. })
  2748. minetest.register_node("witchcraft:potion_cyan", {
  2749. description = "Light Potion",
  2750. drawtype = "plantlike",
  2751. stack_max = 1,
  2752. tiles = {"witchcraft_potion_cyan.png"},
  2753. wield_image = "witchcraft_potion_cyan.png",
  2754. paramtype = "light",
  2755. is_ground_content = false,
  2756. walkable = false,
  2757. selection_box = {
  2758. type = "fixed",
  2759. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2760. },
  2761. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  2762. sounds = default.node_sound_glass_defaults(),
  2763. inventory_image = "witchcraft_potion_cyan.png",
  2764. on_use = function(item, user, pointed_thing)
  2765. local player = user:get_player_name()
  2766. local breath_change = user:set_breath(5)
  2767. playereffects.apply_effect_type("witchcraft:potion_antigrav_lvx", 10, user)
  2768. local playerpos = user:getpos();
  2769. minetest.add_particlespawner(
  2770. 5, --amount
  2771. 0.1, --time
  2772. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  2773. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  2774. {x=-0, y=-0, z=-0}, --minvel
  2775. {x=0, y=0, z=0}, --maxvel
  2776. {x=-0.5,y=4,z=-0.5}, --minacc
  2777. {x=0.5,y=4,z=0.5}, --maxacc
  2778. 0.5, --minexptime
  2779. 1, --maxexptime
  2780. 1, --minsize
  2781. 2, --maxsize
  2782. false, --collisiondetection
  2783. "witchcraft_effect.png" --texture
  2784. )
  2785. item:replace("vessels:glass_bottle")
  2786. return item
  2787. end
  2788. })
  2789. minetest.register_node("witchcraft:potion_gcyan", {
  2790. description = "Air Potion",
  2791. drawtype = "plantlike",
  2792. stack_max = 1,
  2793. tiles = {"witchcraft_potion_gcyan.png"},
  2794. wield_image = "witchcraft_potion_gcyan.png",
  2795. paramtype = "light",
  2796. is_ground_content = false,
  2797. walkable = false,
  2798. selection_box = {
  2799. type = "fixed",
  2800. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2801. },
  2802. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2803. sounds = default.node_sound_glass_defaults(),
  2804. inventory_image = "witchcraft_potion_gcyan.png",
  2805. on_use = function(item, user, pointed_thing)
  2806. local player = user:get_player_name()
  2807. local breath_change = user:set_breath(12)
  2808. local playerpos = user:getpos();
  2809. minetest.add_particlespawner(
  2810. 5, --amount
  2811. 0.1, --time
  2812. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  2813. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  2814. {x=-0, y=-0, z=-0}, --minvel
  2815. {x=0, y=0, z=0}, --maxvel
  2816. {x=-0.5,y=4,z=-0.5}, --minacc
  2817. {x=0.5,y=4,z=0.5}, --maxacc
  2818. 0.5, --minexptime
  2819. 1, --maxexptime
  2820. 1, --minsize
  2821. 2, --maxsize
  2822. false, --collisiondetection
  2823. "witchcraft_effect.png" --texture
  2824. )
  2825. item:replace("vessels:glass_bottle")
  2826. return item
  2827. end
  2828. })
  2829. minetest.register_node("witchcraft:potion_cyan_2", {
  2830. description = "Light Potion (lv2)",
  2831. drawtype = "plantlike",
  2832. stack_max = 1,
  2833. tiles = {"witchcraft_potion_cyan.png^[colorize:black:50"},
  2834. wield_image = "witchcraft_potion_cyan.png^[colorize:black:50",
  2835. paramtype = "light",
  2836. is_ground_content = false,
  2837. walkable = false,
  2838. selection_box = {
  2839. type = "fixed",
  2840. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2841. },
  2842. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2843. sounds = default.node_sound_glass_defaults(),
  2844. inventory_image = "witchcraft_potion_cyan.png^[colorize:black:50",
  2845. on_use = function(item, user, pointed_thing)
  2846. local player = user:get_player_name()
  2847. local breath_change = user:set_breath(5)
  2848. playereffects.apply_effect_type("witchcraft:potion_antigrav_lvx", 20, user)
  2849. local playerpos = user:getpos();
  2850. minetest.add_particlespawner(
  2851. 5, --amount
  2852. 0.1, --time
  2853. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  2854. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  2855. {x=-0, y=-0, z=-0}, --minvel
  2856. {x=0, y=0, z=0}, --maxvel
  2857. {x=-0.5,y=4,z=-0.5}, --minacc
  2858. {x=0.5,y=4,z=0.5}, --maxacc
  2859. 0.5, --minexptime
  2860. 1, --maxexptime
  2861. 1, --minsize
  2862. 2, --maxsize
  2863. false, --collisiondetection
  2864. "witchcraft_effect.png" --texture
  2865. )
  2866. item:replace("vessels:glass_bottle")
  2867. return item
  2868. end
  2869. })
  2870. minetest.register_node("witchcraft:potion_green2", {
  2871. description = "Volatile Potion",
  2872. drawtype = "plantlike",
  2873. stack_max = 1,
  2874. tiles = {"witchcraft_potion_green2.png"},
  2875. wield_image = "witchcraft_potion_green2.png",
  2876. paramtype = "light",
  2877. is_ground_content = false,
  2878. walkable = false,
  2879. selection_box = {
  2880. type = "fixed",
  2881. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2882. },
  2883. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  2884. sounds = default.node_sound_glass_defaults(),
  2885. inventory_image = "witchcraft_potion_green2.png",
  2886. on_use = function(item, user, pointed_thing)
  2887. local player = user:get_player_name()
  2888. local breath_change = user:set_breath(5)
  2889. playereffects.apply_effect_type("witchcraft:potion_jump_lvx", 6, user)
  2890. local playerpos = user:getpos();
  2891. minetest.add_particlespawner(
  2892. 5, --amount
  2893. 0.1, --time
  2894. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  2895. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  2896. {x=-0, y=-0, z=-0}, --minvel
  2897. {x=0, y=0, z=0}, --maxvel
  2898. {x=-0.5,y=4,z=-0.5}, --minacc
  2899. {x=0.5,y=4,z=0.5}, --maxacc
  2900. 0.5, --minexptime
  2901. 1, --maxexptime
  2902. 1, --minsize
  2903. 2, --maxsize
  2904. false, --collisiondetection
  2905. "witchcraft_effect.png" --texture
  2906. )
  2907. item:replace("vessels:glass_bottle")
  2908. return item
  2909. end
  2910. })
  2911. minetest.register_node("witchcraft:potion_ggreen", {
  2912. description = "Darkness Potion",
  2913. drawtype = "plantlike",
  2914. stack_max = 1,
  2915. tiles = {"witchcraft_potion_ggreen.png"},
  2916. wield_image = "witchcraft_potion_ggreen.png",
  2917. paramtype = "light",
  2918. is_ground_content = false,
  2919. walkable = false,
  2920. selection_box = {
  2921. type = "fixed",
  2922. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2923. },
  2924. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2925. sounds = default.node_sound_glass_defaults(),
  2926. inventory_image = "witchcraft_potion_ggreen.png",
  2927. on_use = function(item, user, pointed_thing)
  2928. local player = user:get_player_name()
  2929. local playerpos = user:getpos();
  2930. minetest.add_particlespawner(
  2931. 2000, --amount
  2932. 1, --time
  2933. {x=playerpos.x-20, y=playerpos.y-3, z=playerpos.z-20}, --minpos
  2934. {x=playerpos.x+20, y=playerpos.y+3, z=playerpos.z+20}, --maxpos
  2935. {x=-0, y=-0, z=-0}, --minvel
  2936. {x=0, y=0, z=0}, --maxvel
  2937. {x=-0.1,y=0,z=-0.1}, --minacc
  2938. {x=0.1,y=0,z=0.1}, --maxacc
  2939. 5, --minexptime
  2940. 10, --maxexptime
  2941. 10, --minsize
  2942. 20, --maxsize
  2943. false, --collisiondetection
  2944. "witchcraft_pot_bottom.png^[colorize:black:200" --texture
  2945. )
  2946. local mtime = minetest.get_timeofday()
  2947. if mtime >= 0.25 and mtime <= 0.75 then
  2948. user:override_day_night_ratio(-mtime+0.5)
  2949. minetest.after(10, function()
  2950. user:override_day_night_ratio(nil)
  2951. end)
  2952. end
  2953. item:replace("vessels:glass_bottle")
  2954. return item
  2955. end
  2956. })
  2957. minetest.register_node("witchcraft:potion_green2_2", {
  2958. description = "Volatile Potion (lv2)",
  2959. drawtype = "plantlike",
  2960. stack_max = 1,
  2961. tiles = {"witchcraft_potion_green2.png^[colorize:black:50"},
  2962. wield_image = "witchcraft_potion_green2.png^[colorize:black:50",
  2963. paramtype = "light",
  2964. is_ground_content = false,
  2965. walkable = false,
  2966. selection_box = {
  2967. type = "fixed",
  2968. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  2969. },
  2970. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  2971. sounds = default.node_sound_glass_defaults(),
  2972. inventory_image = "witchcraft_potion_green2.png^[colorize:black:50",
  2973. on_use = function(item, user, pointed_thing)
  2974. local player = user:get_player_name()
  2975. local breath_change = user:set_breath(5)
  2976. playereffects.apply_effect_type("witchcraft:potion_jump_lvx", 10, user)
  2977. local playerpos = user:getpos();
  2978. minetest.add_particlespawner(
  2979. 5, --amount
  2980. 0.1, --time
  2981. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  2982. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  2983. {x=-0, y=-0, z=-0}, --minvel
  2984. {x=0, y=0, z=0}, --maxvel
  2985. {x=-0.5,y=4,z=-0.5}, --minacc
  2986. {x=0.5,y=4,z=0.5}, --maxacc
  2987. 0.5, --minexptime
  2988. 1, --maxexptime
  2989. 1, --minsize
  2990. 2, --maxsize
  2991. false, --collisiondetection
  2992. "witchcraft_effect.png" --texture
  2993. )
  2994. item:replace("vessels:glass_bottle")
  2995. return item
  2996. end
  2997. })
  2998. minetest.register_node("witchcraft:potion_redbrown", {
  2999. description = "Thick Potion",
  3000. drawtype = "plantlike",
  3001. tiles = {"witchcraft_potion_redbrown.png"},
  3002. wield_image = "witchcraft_potion_redbrown.png",
  3003. paramtype = "light",
  3004. stack_max = 1,
  3005. is_ground_content = false,
  3006. walkable = false,
  3007. selection_box = {
  3008. type = "fixed",
  3009. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  3010. },
  3011. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  3012. sounds = default.node_sound_glass_defaults(),
  3013. inventory_image = "witchcraft_potion_redbrown.png",
  3014. on_use = function(item, user, pointed_thing)
  3015. local player = user:get_player_name()
  3016. local breath_change = user:set_breath(5)
  3017. playereffects.apply_effect_type("witchcraft:potion_slow_lv1", 11, user)
  3018. local playerpos = user:getpos();
  3019. minetest.add_particlespawner(
  3020. 5, --amount
  3021. 0.1, --time
  3022. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  3023. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  3024. {x=-0, y=-0, z=-0}, --minvel
  3025. {x=0, y=0, z=0}, --maxvel
  3026. {x=-0.5,y=4,z=-0.5}, --minacc
  3027. {x=0.5,y=4,z=0.5}, --maxacc
  3028. 0.5, --minexptime
  3029. 1, --maxexptime
  3030. 1, --minsize
  3031. 2, --maxsize
  3032. false, --collisiondetection
  3033. "witchcraft_effect.png" --texture
  3034. )
  3035. item:replace("vessels:glass_bottle")
  3036. return item
  3037. end
  3038. })
  3039. minetest.register_node("witchcraft:potion_redbrown_2", {
  3040. description = "Thick Potion (lv2)",
  3041. drawtype = "plantlike",
  3042. tiles = {"witchcraft_potion_redbrown.png^[colorize:black:50"},
  3043. wield_image = "witchcraft_potion_redbrown.png^[colorize:black:50",
  3044. paramtype = "light",
  3045. stack_max = 1,
  3046. is_ground_content = false,
  3047. walkable = false,
  3048. selection_box = {
  3049. type = "fixed",
  3050. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  3051. },
  3052. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  3053. sounds = default.node_sound_glass_defaults(),
  3054. inventory_image = "witchcraft_potion_redbrown.png^[colorize:black:50",
  3055. on_use = function(item, user, pointed_thing)
  3056. local player = user:get_player_name()
  3057. local breath_change = user:set_breath(5)
  3058. playereffects.apply_effect_type("witchcraft:potion_slow_lv2", 15, user)
  3059. local playerpos = user:getpos();
  3060. minetest.add_particlespawner(
  3061. 5, --amount
  3062. 0.1, --time
  3063. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  3064. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  3065. {x=-0, y=-0, z=-0}, --minvel
  3066. {x=0, y=0, z=0}, --maxvel
  3067. {x=-0.5,y=4,z=-0.5}, --minacc
  3068. {x=0.5,y=4,z=0.5}, --maxacc
  3069. 0.5, --minexptime
  3070. 1, --maxexptime
  3071. 1, --minsize
  3072. 2, --maxsize
  3073. false, --collisiondetection
  3074. "witchcraft_effect.png" --texture
  3075. )
  3076. item:replace("vessels:glass_bottle")
  3077. return item
  3078. end
  3079. })
  3080. minetest.register_node("witchcraft:potion_blue2", {
  3081. description = "Watery Potion",
  3082. drawtype = "plantlike",
  3083. stack_max = 1,
  3084. tiles = {"witchcraft_potion_blue2.png"},
  3085. wield_image = "witchcraft_potion_blue2.png",
  3086. paramtype = "light",
  3087. is_ground_content = false,
  3088. walkable = false,
  3089. selection_box = {
  3090. type = "fixed",
  3091. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  3092. },
  3093. groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
  3094. sounds = default.node_sound_glass_defaults(),
  3095. inventory_image = "witchcraft_potion_blue2.png",
  3096. on_use = function(item, user, pointed_thing)
  3097. local player = user:get_player_name()
  3098. local breath = user:get_breath()
  3099. if breath <= 10 then
  3100. playereffects.apply_effect_type("witchcraft:potion_swim_lv1", 15, user)
  3101. local playerpos = user:getpos();
  3102. minetest.add_particlespawner(
  3103. 5, --amount
  3104. 0.1, --time
  3105. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  3106. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  3107. {x=-0, y=-0, z=-0}, --minvel
  3108. {x=0, y=0, z=0}, --maxvel
  3109. {x=-0.5,y=4,z=-0.5}, --minacc
  3110. {x=0.5,y=4,z=0.5}, --maxacc
  3111. 0.5, --minexptime
  3112. 1, --maxexptime
  3113. 1, --minsize
  3114. 2, --maxsize
  3115. false, --collisiondetection
  3116. "witchcraft_effect.png" --texture
  3117. )
  3118. item:replace("vessels:glass_bottle")
  3119. return item
  3120. end
  3121. end
  3122. })
  3123. minetest.register_node("witchcraft:potion_blue2_2", {
  3124. description = "Watery Potion (lv2)",
  3125. drawtype = "plantlike",
  3126. stack_max = 1,
  3127. tiles = {"witchcraft_potion_blue2.png^[colorize:black:50"},
  3128. wield_image = "witchcraft_potion_blue2.png^[colorize:black:50",
  3129. paramtype = "light",
  3130. is_ground_content = false,
  3131. walkable = false,
  3132. selection_box = {
  3133. type = "fixed",
  3134. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  3135. },
  3136. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  3137. sounds = default.node_sound_glass_defaults(),
  3138. inventory_image = "witchcraft_potion_blue2.png^[colorize:black:50",
  3139. on_use = function(item, user, pointed_thing)
  3140. local player = user:get_player_name()
  3141. local breath = user:get_breath()
  3142. if breath <= 10 then
  3143. playereffects.apply_effect_type("witchcraft:potion_swim_lv2", 15, user)
  3144. local playerpos = user:getpos();
  3145. minetest.add_particlespawner(
  3146. 5, --amount
  3147. 0.1, --time
  3148. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  3149. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  3150. {x=-0, y=-0, z=-0}, --minvel
  3151. {x=0, y=0, z=0}, --maxvel
  3152. {x=-0.5,y=4,z=-0.5}, --minacc
  3153. {x=0.5,y=4,z=0.5}, --maxacc
  3154. 0.5, --minexptime
  3155. 1, --maxexptime
  3156. 1, --minsize
  3157. 2, --maxsize
  3158. false, --collisiondetection
  3159. "witchcraft_effect.png" --texture
  3160. )
  3161. item:replace("vessels:glass_bottle")
  3162. return item
  3163. end
  3164. end
  3165. })
  3166. --light potion
  3167. function lightchange(person, duration)
  3168. local mtime = minetest.get_timeofday()
  3169. if mtime <= 0.25 or mtime >= 0.75 then
  3170. person:override_day_night_ratio(mtime+0.5)
  3171. minetest.after(duration, function()
  3172. person:override_day_night_ratio(nil)
  3173. end)
  3174. end
  3175. end
  3176. minetest.register_node("witchcraft:potion_yellow", {
  3177. description = "Shiny Potion",
  3178. drawtype = "plantlike",
  3179. stack_max = 1,
  3180. tiles = {"witchcraft_potion_yellow.png"},
  3181. wield_image = "witchcraft_potion_yellow.png",
  3182. paramtype = "light",
  3183. is_ground_content = false,
  3184. walkable = false,
  3185. selection_box = {
  3186. type = "fixed",
  3187. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  3188. },
  3189. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  3190. sounds = default.node_sound_glass_defaults(),
  3191. inventory_image = "witchcraft_potion_yellow.png",
  3192. on_use = function(item, user, pointed_thing)
  3193. local player = user:get_player_name()
  3194. lightchange(user, 10)
  3195. local playerpos = user:getpos();
  3196. minetest.add_particlespawner(
  3197. 5, --amount
  3198. 0.1, --time
  3199. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  3200. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  3201. {x=-0, y=-0, z=-0}, --minvel
  3202. {x=0, y=0, z=0}, --maxvel
  3203. {x=-0.5,y=4,z=-0.5}, --minacc
  3204. {x=0.5,y=4,z=0.5}, --maxacc
  3205. 0.5, --minexptime
  3206. 1, --maxexptime
  3207. 1, --minsize
  3208. 2, --maxsize
  3209. false, --collisiondetection
  3210. "witchcraft_effect.png" --texture
  3211. )
  3212. item:replace("vessels:glass_bottle")
  3213. return item
  3214. end
  3215. })
  3216. minetest.register_node("witchcraft:potion_yellow_2", {
  3217. description = "Shiny Potion (lv2)",
  3218. drawtype = "plantlike",
  3219. stack_max = 1,
  3220. tiles = {"witchcraft_potion_yellow.png^[colorize:black:50"},
  3221. wield_image = "witchcraft_potion_yellow.png^[colorize:black:50",
  3222. paramtype = "light",
  3223. is_ground_content = false,
  3224. walkable = false,
  3225. selection_box = {
  3226. type = "fixed",
  3227. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  3228. },
  3229. groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
  3230. sounds = default.node_sound_glass_defaults(),
  3231. inventory_image = "witchcraft_potion_yellow.png^[colorize:black:50",
  3232. on_use = function(item, user, pointed_thing)
  3233. lightchange(user, 20)
  3234. local playerpos = user:getpos();
  3235. minetest.add_particlespawner(
  3236. 5, --amount
  3237. 0.1, --time
  3238. {x=playerpos.x-1, y=playerpos.y+1, z=playerpos.z-1}, --minpos
  3239. {x=playerpos.x+1, y=playerpos.y+1, z=playerpos.z+1}, --maxpos
  3240. {x=-0, y=-0, z=-0}, --minvel
  3241. {x=0, y=0, z=0}, --maxvel
  3242. {x=-0.5,y=4,z=-0.5}, --minacc
  3243. {x=0.5,y=4,z=0.5}, --maxacc
  3244. 0.5, --minexptime
  3245. 1, --maxexptime
  3246. 1, --minsize
  3247. 2, --maxsize
  3248. false, --collisiondetection
  3249. "witchcraft_effect.png" --texture
  3250. )
  3251. item:replace("vessels:glass_bottle")
  3252. return item
  3253. end
  3254. })
  3255. --invisibility potion by Tenplus1(DWTFYWT V2), see darkpurple potion for on_use effect
  3256. invisibility = {}
  3257. -- reset player invisibility if they go offline
  3258. minetest.register_on_leaveplayer(function(player)
  3259. local name = player:get_player_name()
  3260. if invisibility[name] then
  3261. invisibility[name] = nil
  3262. end
  3263. end)
  3264. invisible = function(player, toggle)
  3265. if not player then return false end
  3266. local name = player:get_player_name()
  3267. invisibility[name] = toggle
  3268. local prop
  3269. if toggle == true then
  3270. -- hide player and name tag
  3271. prop = {
  3272. visual_size = {x = 0, y = 0},
  3273. collisionbox = {0, 0, 0, 0, 0, 0}
  3274. }
  3275. player:set_nametag_attributes({
  3276. color = {a = 0, r = 255, g = 255, b = 255}
  3277. })
  3278. else
  3279. -- show player and tag
  3280. prop = {
  3281. visual_size = {x = 1, y = 1},
  3282. collisionbox = {-0.35, -1, -0.35, 0.35, 1, 0.35}
  3283. }
  3284. player:set_nametag_attributes({
  3285. color = {a = 255, r = 255, g = 255, b = 255}
  3286. })
  3287. end
  3288. player:set_properties(prop)
  3289. end
  3290. --decorative nodes
  3291. minetest.register_node("witchcraft:mortar", {
  3292. description = "mortar and pestle",
  3293. tiles = {
  3294. "default_stone.png",
  3295. "default_stone.png",
  3296. "default_stone.png",
  3297. "default_stone.png",
  3298. "default_stone.png",
  3299. "default_stone.png"
  3300. },
  3301. drawtype = "nodebox",
  3302. paramtype = "light",
  3303. paramtype2 = "facedir",
  3304. node_box = {
  3305. type = "fixed",
  3306. fixed = {
  3307. {-0.25, -0.5, -0.25, 0.25, -0.4375, 0.25}, -- NodeBox1
  3308. {-0.1875, -0.4375, -0.1875, 0.1875, -0.375, 0.1875}, -- NodeBox2
  3309. {-0.3125, -0.375, -0.3125, -0.1875, 0.125, 0.3125}, -- NodeBox3
  3310. {0.1875, -0.375, -0.3125, 0.3125, 0.125, 0.3125}, -- NodeBox4
  3311. {-0.3125, -0.375, -0.3125, 0.3125, 0.125, -0.1875}, -- NodeBox5
  3312. {-0.3125, -0.375, 0.1875, 0.3125, 0.125, 0.3125}, -- NodeBox6
  3313. {-0.1875, -0.375, -0.1875, 0.25, -0.0625, 0.1875}, -- NodeBox7
  3314. {-0.3125, -0.5, -0.5, 0.3125, -0.375, -0.375}, -- NodeBox8
  3315. }
  3316. },
  3317. groups = {cracky=1, oddly_breakable_by_hand=1}
  3318. })
  3319. minetest.register_node("witchcraft:pentablock", {
  3320. description = "Pentagram block",
  3321. tiles = {
  3322. "witchcraft_pentablock.png",
  3323. },
  3324. groups = {cracky=1, oddly_breakable_by_hand=1}
  3325. })
  3326. minetest.register_node("witchcraft:pentagram", {
  3327. description = "pentagram",
  3328. drawtype = "signlike",
  3329. visual_scale = 3.0,
  3330. tiles = {"witchcraft_pentagram.png"},
  3331. inventory_image = "witchcraft_pentagram.png",
  3332. use_texture_alpha = true,
  3333. paramtype = "light",
  3334. paramtype2 = "wallmounted",
  3335. sunlight_propagates = false,
  3336. light_source = 14,
  3337. walkable = false,
  3338. is_ground_content = true,
  3339. selection_box = {
  3340. type = "wallmounted",
  3341. fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
  3342. },
  3343. on_rightclick = function(pos, node, _)
  3344. if minetest.get_modpath("mobs") then
  3345. minetest.after(0.5, function()
  3346. minetest.set_node(pos, {name="witchcraft:portal", param2=node.param2})
  3347. minetest.add_particlespawner(
  3348. 25, --amount
  3349. 1, --time
  3350. {x=pos.x-1, y=pos.y, z=pos.z-1}, --minpos
  3351. {x=pos.x+1, y=pos.y, z=pos.z+1}, --maxpos
  3352. {x=-0, y=-0, z=-0}, --minvel
  3353. {x=0, y=0, z=0}, --maxvel
  3354. {x=-0.5,y=1,z=-0.5}, --minacc
  3355. {x=0.5,y=1,z=0.5}, --maxacc
  3356. 1, --minexptime
  3357. 1.5, --maxexptime
  3358. 1, --minsize
  3359. 2, --maxsize
  3360. false, --collisiondetection
  3361. "witchcraft_effect.png^[colorize:green:400" --texture
  3362. )
  3363. end)
  3364. end
  3365. end,
  3366. groups = {cracky=3,dig_immediate=3},
  3367. })
  3368. minetest.register_node("witchcraft:portal", {
  3369. description = "portal",
  3370. drawtype = "signlike",
  3371. visual_scale = 3.0,
  3372. tiles = {"witchcraft_portal.png"},
  3373. inventory_image = "witchcraft_portal.png",
  3374. use_texture_alpha = true,
  3375. paramtype = "light",
  3376. paramtype2 = "wallmounted",
  3377. sunlight_propagates = false,
  3378. light_source = 14,
  3379. walkable = false,
  3380. is_ground_content = true,
  3381. selection_box = {
  3382. type = "wallmounted",
  3383. fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
  3384. },
  3385. on_construct = function(pos, node, _)
  3386. minetest.after(1, function()
  3387. if minetest.get_modpath("horror") then
  3388. minetest.env:add_entity(pos, "horror:werewolf")
  3389. elseif minetest.get_modpath("dmobs") then
  3390. minetest.env:add_entity(pos, "dmobs:owl")
  3391. elseif minetest.get_modpath("mobs_animal") then
  3392. minetest.env:add_entity(pos, "mobs_animal:kitten")
  3393. elseif minetest.get_modpath("mobs_monster") then
  3394. minetest.env:add_entity(pos, "mobs_monster:oerkki")
  3395. elseif minetest.get_modpath("pmobs") then
  3396. minetest.env:add_entity(pos, "pmobs:wolf")
  3397. end
  3398. minetest.remove_node(pos)
  3399. end)
  3400. end,
  3401. groups = {cracky=3,dig_immediate=3, not_in_creative_inventory=1},
  3402. })
  3403. minetest.register_node("witchcraft:candle", {
  3404. description = "red candle",
  3405. tiles = {
  3406. "witchcraft_candle_top.png",
  3407. "witchcraft_candle_top.png",
  3408. "witchcraft_candle.png",
  3409. "witchcraft_candle.png",
  3410. "witchcraft_candle.png",
  3411. "witchcraft_candle.png"
  3412. },
  3413. drawtype = "nodebox",
  3414. paramtype = "light",
  3415. node_box = {
  3416. type = "fixed",
  3417. fixed = {
  3418. {-0.1875, -0.5, -0.1875, 0.1875, -0.0625, 0.1875}, -- NodeBox1
  3419. {-0.03125, -0.5, -0.03125, 0.03125, 0.0625, 0.03125}, -- NodeBox2
  3420. }
  3421. },
  3422. groups = {fleshy=1, oddly_breakable_by_hand=1, dig_immediate=3},
  3423. })
  3424. --other stuff
  3425. dofile(minetest.get_modpath("witchcraft").."/scrolls.lua")
  3426. dofile(minetest.get_modpath("witchcraft").."/plants.lua")
  3427. dofile(minetest.get_modpath("witchcraft").."/brewing_stand.lua")
  3428. if minetest.get_modpath("hunger_ng") then
  3429. dofile(minetest.get_modpath("witchcraft").."/opt/hunger_ng.lua")
  3430. end
  3431. if minetest.get_modpath("lightning") then
  3432. dofile(minetest.get_modpath("witchcraft").."/opt/lightning.lua")
  3433. end