~jadedctrl/gem-xwx-moe
~jadedctrl/gem-xwx-moe/gemujo_ludo/flikaĵoj/mobs_redo/0001-Forigas-a-ojn-nenecesajn-por-Gemujo.patch
~jadedctrl/gem-xwx-moe/gemujo_ludo/flikaĵoj/mobs_redo/0001-Forigas-a-ojn-nenecesajn-por-Gemujo.patch
0 | From d67504d6c8f025e3d6f9785005f71831fdcf17f2 Mon Sep 17 00:00:00 2001 |
1 | From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> |
2 | Date: Mon, 15 Jan 2024 19:59:23 -0600 |
3 | Subject: [PATCH] =?UTF-8?q?Forigas=20a=C4=B5ojn=20nenecesajn=20por=20Gemuj?= |
4 | =?UTF-8?q?o?= |
5 | MIME-Version: 1.0 |
6 | Content-Type: text/plain; charset=UTF-8 |
7 | Content-Transfer-Encoding: 8bit |
8 |
|
9 | T.e., aferoj kiuj sole utilas por dreseblaj bestoj. |
10 | Ni sole uzas mobs_redo por monstroj, ne amikoj! :P |
11 | --- |
12 | crafts.lua | 749 +++++++++++++++++++++++++++-------------------------- |
13 | 1 file changed, 375 insertions(+), 374 deletions(-) |
14 |
|
15 | diff --git a/crafts.lua b/crafts.lua |
16 | index 2c686be..df8c1c9 100644 |
17 | --- a/crafts.lua |
18 | +++ b/crafts.lua |
19 | @@ -21,27 +21,27 @@ local items = { |
20 | meat_cooked = mc2 and "mcl_mobitems:cooked_beef" or "group:food_meat", |
21 | } |
22 | |
23 | --- name tag |
24 | -minetest.register_craftitem("mobs:nametag", { |
25 | - description = S("Name Tag"), |
26 | - inventory_image = "mobs_nametag.png", |
27 | - groups = {flammable = 2, nametag = 1} |
28 | -}) |
29 | - |
30 | -minetest.register_craft({ |
31 | - output = "mobs:nametag", |
32 | - recipe = { |
33 | - { items.paper, items.dye_black, items.string } |
34 | - } |
35 | -}) |
36 | - |
37 | --- leather |
38 | -minetest.register_craftitem("mobs:leather", { |
39 | - description = S("Leather"), |
40 | - inventory_image = "mobs_leather.png", |
41 | - groups = {flammable = 2, leather = 1} |
42 | -}) |
43 | - |
44 | +---- name tag |
45 | +--minetest.register_craftitem("mobs:nametag", { |
46 | +-- description = S("Name Tag"), |
47 | +-- inventory_image = "mobs_nametag.png", |
48 | +-- groups = {flammable = 2, nametag = 1} |
49 | +--}) |
50 | +-- |
51 | +--minetest.register_craft({ |
52 | +-- output = "mobs:nametag", |
53 | +-- recipe = { |
54 | +-- { items.paper, items.dye_black, items.string } |
55 | +-- } |
56 | +--}) |
57 | +-- |
58 | +---- leather |
59 | +--minetest.register_craftitem("mobs:leather", { |
60 | +-- description = S("Leather"), |
61 | +-- inventory_image = "mobs_leather.png", |
62 | +-- groups = {flammable = 2, leather = 1} |
63 | +--}) |
64 | +-- |
65 | -- raw meat |
66 | minetest.register_craftitem("mobs:meat_raw", { |
67 | description = S("Raw Meat"), |
68 | @@ -65,356 +65,357 @@ minetest.register_craft({ |
69 | cooktime = 5 |
70 | }) |
71 | |
72 | --- lasso |
73 | -minetest.register_tool("mobs:lasso", { |
74 | - description = S("Lasso (right-click animal to put in inventory)"), |
75 | - inventory_image = "mobs_magic_lasso.png", |
76 | - groups = {flammable = 2} |
77 | -}) |
78 | - |
79 | -minetest.register_craft({ |
80 | - output = "mobs:lasso", |
81 | - recipe = { |
82 | - { items.string, "", items.string}, |
83 | - { "", items.diamond, "" }, |
84 | - { items.string, "", items.string } |
85 | - } |
86 | -}) |
87 | - |
88 | -minetest.register_alias("mobs:magic_lasso", "mobs:lasso") |
89 | - |
90 | --- net |
91 | -minetest.register_tool("mobs:net", { |
92 | - description = S("Net (right-click animal to put in inventory)"), |
93 | - inventory_image = "mobs_net.png", |
94 | - groups = {flammable = 2} |
95 | -}) |
96 | - |
97 | -minetest.register_craft({ |
98 | - output = "mobs:net", |
99 | - recipe = { |
100 | - { items.stick, "", items.stick }, |
101 | - { items.stick, "", items.stick }, |
102 | - { items.string, items.stick, items.string } |
103 | - } |
104 | -}) |
105 | - |
106 | --- shears (right click to shear animal) |
107 | -minetest.register_tool("mobs:shears", { |
108 | - description = S("Steel Shears (right-click to shear)"), |
109 | - inventory_image = "mobs_shears.png", |
110 | - groups = {flammable = 2} |
111 | -}) |
112 | - |
113 | -minetest.register_craft({ |
114 | - output = "mobs:shears", |
115 | - recipe = { |
116 | - { "", items.steel_ingot, "" }, |
117 | - { "", items.stick, items.steel_ingot } |
118 | - } |
119 | -}) |
120 | - |
121 | --- protection rune |
122 | -minetest.register_craftitem("mobs:protector", { |
123 | - description = S("Mob Protection Rune"), |
124 | - inventory_image = "mobs_protector.png", |
125 | - groups = {flammable = 2} |
126 | -}) |
127 | - |
128 | -minetest.register_craft({ |
129 | - output = "mobs:protector", |
130 | - recipe = { |
131 | - { items.stone, items.stone, items.stone }, |
132 | - { items.stone, items.gold_block, items.stone }, |
133 | - { items.stone, items.stone, items.stone } |
134 | - } |
135 | -}) |
136 | - |
137 | --- level 2 protection rune |
138 | -minetest.register_craftitem("mobs:protector2", { |
139 | - description = S("Mob Protection Rune (Level 2)"), |
140 | - inventory_image = "mobs_protector2.png", |
141 | - groups = {flammable = 2} |
142 | -}) |
143 | - |
144 | -minetest.register_craft({ |
145 | - output = "mobs:protector2", |
146 | - recipe = { |
147 | - { "mobs:protector", items.mese_crystal, "mobs:protector" }, |
148 | - { items.mese_crystal, items.diamond_block, items.mese_crystal }, |
149 | - { "mobs:protector", items.mese_crystal, "mobs:protector" } |
150 | - } |
151 | -}) |
152 | - |
153 | --- saddle |
154 | -minetest.register_craftitem("mobs:saddle", { |
155 | - description = S("Saddle"), |
156 | - inventory_image = "mobs_saddle.png", |
157 | - groups = {flammable = 2, saddle = 1} |
158 | -}) |
159 | - |
160 | -minetest.register_craft({ |
161 | - output = "mobs:saddle", |
162 | - recipe = { |
163 | - {"mobs:leather", "mobs:leather", "mobs:leather"}, |
164 | - {"mobs:leather", items.steel_ingot, "mobs:leather"}, |
165 | - {"mobs:leather", items.steel_ingot, "mobs:leather"} |
166 | - } |
167 | -}) |
168 | - |
169 | - |
170 | --- make sure we can register fences |
171 | -local mod_def = minetest.get_modpath("default") |
172 | - |
173 | -if mod_def and default.register_fence then |
174 | - |
175 | --- mob fence (looks like normal fence but collision is 2 high) |
176 | -default.register_fence("mobs:fence_wood", { |
177 | - description = S("Mob Fence"), |
178 | - texture = "default_wood.png", |
179 | - material = "default:fence_wood", |
180 | - groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, |
181 | - sounds = mod_def and default.node_sound_wood_defaults(), |
182 | - collision_box = { |
183 | - type = "fixed", |
184 | - fixed = { |
185 | - {-0.5, -0.5, -0.5, 0.5, 1.9, 0.5}, |
186 | - } |
187 | - } |
188 | -}) |
189 | -end |
190 | - |
191 | --- mob fence top (has enlarged collisionbox to stop mobs getting over) |
192 | -minetest.register_node("mobs:fence_top", { |
193 | - description = S("Mob Fence Top"), |
194 | - drawtype = "nodebox", |
195 | - tiles = {"default_wood.png"}, |
196 | - paramtype = "light", |
197 | - is_ground_content = false, |
198 | - groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, |
199 | - sounds = mod_def and default.node_sound_wood_defaults(), |
200 | - node_box = { |
201 | - type = "fixed", |
202 | - fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2} |
203 | - }, |
204 | - collision_box = { |
205 | - type = "fixed", |
206 | - fixed = {-0.4, -1.5, -0.4, 0.4, 0, 0.4} |
207 | - }, |
208 | - selection_box = { |
209 | - type = "fixed", |
210 | - fixed = {-0.4, -1.5, -0.4, 0.4, 0, 0.4} |
211 | - } |
212 | -}) |
213 | - |
214 | -minetest.register_craft({ |
215 | - output = "mobs:fence_top 12", |
216 | - recipe = { |
217 | - {"group:wood", "group:wood", "group:wood"}, |
218 | - {"", items.fence_wood, ""} |
219 | - } |
220 | -}) |
221 | - |
222 | - |
223 | --- items that can be used as fuel |
224 | -minetest.register_craft({ |
225 | - type = "fuel", |
226 | - recipe = "mobs:nametag", |
227 | - burntime = 3 |
228 | -}) |
229 | - |
230 | -minetest.register_craft({ |
231 | - type = "fuel", |
232 | - recipe = "mobs:lasso", |
233 | - burntime = 7 |
234 | -}) |
235 | - |
236 | -minetest.register_craft({ |
237 | - type = "fuel", |
238 | - recipe = "mobs:net", |
239 | - burntime = 8 |
240 | -}) |
241 | - |
242 | -minetest.register_craft({ |
243 | - type = "fuel", |
244 | - recipe = "mobs:leather", |
245 | - burntime = 4 |
246 | -}) |
247 | - |
248 | -minetest.register_craft({ |
249 | - type = "fuel", |
250 | - recipe = "mobs:saddle", |
251 | - burntime = 7 |
252 | -}) |
253 | - |
254 | -minetest.register_craft({ |
255 | - type = "fuel", |
256 | - recipe = "mobs:fence_wood", |
257 | - burntime = 7 |
258 | -}) |
259 | - |
260 | -minetest.register_craft({ |
261 | - type = "fuel", |
262 | - recipe = "mobs:fence_top", |
263 | - burntime = 2 |
264 | -}) |
265 | - |
266 | - |
267 | --- this tool spawns same mob and adds owner, protected, nametag info |
268 | --- then removes original entity, this is used for fixing any issues. |
269 | --- also holding sneak while punching mob lets you change texture name. |
270 | - |
271 | -local tex_obj |
272 | - |
273 | -minetest.register_tool(":mobs:mob_reset_stick", { |
274 | - description = S("Mob Reset Stick"), |
275 | - inventory_image = "default_stick.png^[colorize:#ff000050", |
276 | - stack_max = 1, |
277 | - groups = {not_in_creative_inventory = 1}, |
278 | - |
279 | - on_use = function(itemstack, user, pointed_thing) |
280 | - |
281 | - if pointed_thing.type ~= "object" then |
282 | - return |
283 | - end |
284 | - |
285 | - local obj = pointed_thing.ref |
286 | - |
287 | - local control = user:get_player_control() |
288 | - local sneak = control and control.sneak |
289 | - |
290 | - -- spawn same mob with saved stats, with random texture |
291 | - if obj and not sneak then |
292 | - |
293 | - local self = obj:get_luaentity() |
294 | - local obj2 = minetest.add_entity(obj:get_pos(), self.name) |
295 | - |
296 | - if obj2 then |
297 | - |
298 | - local ent2 = obj2:get_luaentity() |
299 | - |
300 | - ent2.protected = self.protected |
301 | - ent2.owner = self.owner |
302 | - ent2.nametag = self.nametag |
303 | - ent2.gotten = self.gotten |
304 | - ent2.tamed = self.tamed |
305 | - ent2.health = self.health |
306 | - ent2.order = self.order |
307 | - |
308 | - if self.child then |
309 | - obj2:set_velocity({x = 0, y = self.jump_height, z = 0}) |
310 | - end |
311 | - |
312 | - obj2:set_properties({nametag = self.nametag}) |
313 | - |
314 | - obj:remove() |
315 | - end |
316 | - end |
317 | - |
318 | - -- display form to enter texture name ending in .png |
319 | - if obj and sneak then |
320 | - |
321 | - tex_obj = obj |
322 | - |
323 | - -- get base texture |
324 | - local bt = tex_obj:get_luaentity().base_texture[1] |
325 | - |
326 | - if type(bt) ~= "string" then |
327 | - bt = "" |
328 | - end |
329 | - |
330 | - local name = user:get_player_name() |
331 | - |
332 | - minetest.show_formspec(name, "mobs_texture", "size[8,4]" |
333 | - .. "field[0.5,1;7.5,0;name;" |
334 | - .. FS("Enter texture:") .. ";" .. bt .. "]" |
335 | - .. "button_exit[2.5,3.5;3,1;mob_texture_change;" |
336 | - .. FS("Change") .. "]") |
337 | - end |
338 | - end |
339 | -}) |
340 | - |
341 | -minetest.register_on_player_receive_fields(function(player, formname, fields) |
342 | - |
343 | - -- right-clicked with nametag and name entered? |
344 | - if formname == "mobs_texture" |
345 | - and fields.name |
346 | - and fields.name ~= "" then |
347 | - |
348 | - -- does mob still exist? |
349 | - if not tex_obj |
350 | - or not tex_obj:get_luaentity() then |
351 | - return |
352 | - end |
353 | - |
354 | - -- make sure nametag is being used to name mob |
355 | - local item = player:get_wielded_item() |
356 | - |
357 | - if item:get_name() ~= "mobs:mob_reset_stick" then |
358 | - return |
359 | - end |
360 | - |
361 | - -- limit name entered to 64 characters long |
362 | - if fields.name:len() > 64 then |
363 | - fields.name = fields.name:sub(1, 64) |
364 | - end |
365 | - |
366 | - -- update texture |
367 | - local self = tex_obj:get_luaentity() |
368 | - |
369 | - self.base_texture = {fields.name} |
370 | - |
371 | - tex_obj:set_properties({textures = {fields.name}}) |
372 | - |
373 | - -- reset external variable |
374 | - tex_obj = nil |
375 | - end |
376 | -end) |
377 | - |
378 | - |
379 | --- Meat Block |
380 | -minetest.register_node("mobs:meatblock", { |
381 | - description = S("Meat Block"), |
382 | - tiles = {"mobs_meat_top.png", "mobs_meat_bottom.png", "mobs_meat_side.png"}, |
383 | - paramtype2 = "facedir", |
384 | - groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2}, |
385 | - sounds = mod_def and default.node_sound_leaves_defaults(), |
386 | - on_place = minetest.rotate_node, |
387 | - on_use = minetest.item_eat(20) |
388 | -}) |
389 | - |
390 | -minetest.register_craft({ |
391 | - output = "mobs:meatblock", |
392 | - recipe = { |
393 | - { items.meat_cooked, items.meat_cooked, items.meat_cooked }, |
394 | - { items.meat_cooked, items.meat_cooked, items.meat_cooked }, |
395 | - { items.meat_cooked, items.meat_cooked, items.meat_cooked } |
396 | - } |
397 | -}) |
398 | - |
399 | --- Meat Block (raw) |
400 | -minetest.register_node("mobs:meatblock_raw", { |
401 | - description = S("Raw Meat Block"), |
402 | - tiles = {"mobs_meat_raw_top.png", "mobs_meat_raw_bottom.png", "mobs_meat_raw_side.png"}, |
403 | - paramtype2 = "facedir", |
404 | - groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2}, |
405 | - sounds = mod_def and default.node_sound_leaves_defaults(), |
406 | - on_place = minetest.rotate_node, |
407 | - on_use = minetest.item_eat(20) |
408 | -}) |
409 | - |
410 | -minetest.register_craft({ |
411 | - output = "mobs:meatblock_raw", |
412 | - recipe = { |
413 | - { items.meat_raw, items.meat_raw, items.meat_raw }, |
414 | - { items.meat_raw, items.meat_raw, items.meat_raw }, |
415 | - { items.meat_raw, items.meat_raw, items.meat_raw } |
416 | - } |
417 | -}) |
418 | - |
419 | -minetest.register_craft({ |
420 | - type = "cooking", |
421 | - output = "mobs:meatblock", |
422 | - recipe = "mobs:meatblock_raw", |
423 | - cooktime = 30 |
424 | -}) |
425 | +---- lasso |
426 | +--minetest.register_tool("mobs:lasso", { |
427 | +-- description = S("Lasso (right-click animal to put in inventory)"), |
428 | +-- inventory_image = "mobs_magic_lasso.png", |
429 | +-- groups = {flammable = 2} |
430 | +--}) |
431 | +-- |
432 | +--minetest.register_craft({ |
433 | +-- output = "mobs:lasso", |
434 | +-- recipe = { |
435 | +-- { items.string, "", items.string}, |
436 | +-- { "", items.diamond, "" }, |
437 | +-- { items.string, "", items.string } |
438 | +-- } |
439 | +--}) |
440 | +-- |
441 | +--minetest.register_alias("mobs:magic_lasso", "mobs:lasso") |
442 | +-- |
443 | +---- net |
444 | +--minetest.register_tool("mobs:net", { |
445 | +-- description = S("Net (right-click animal to put in inventory)"), |
446 | +-- inventory_image = "mobs_net.png", |
447 | +-- groups = {flammable = 2} |
448 | +--}) |
449 | +-- |
450 | +--minetest.register_craft({ |
451 | +-- output = "mobs:net", |
452 | +-- recipe = { |
453 | +-- { items.stick, "", items.stick }, |
454 | +-- { items.stick, "", items.stick }, |
455 | +-- { items.string, items.stick, items.string } |
456 | +-- } |
457 | +--}) |
458 | +-- |
459 | +---- shears (right click to shear animal) |
460 | +--minetest.register_tool("mobs:shears", { |
461 | +-- description = S("Steel Shears (right-click to shear)"), |
462 | +-- inventory_image = "mobs_shears.png", |
463 | +-- groups = {flammable = 2} |
464 | +--}) |
465 | +-- |
466 | +--minetest.register_craft({ |
467 | +-- output = "mobs:shears", |
468 | +-- recipe = { |
469 | +-- { "", items.steel_ingot, "" }, |
470 | +-- { "", items.stick, items.steel_ingot } |
471 | +-- } |
472 | +--}) |
473 | +-- |
474 | +---- protection rune |
475 | +--minetest.register_craftitem("mobs:protector", { |
476 | +-- description = S("Mob Protection Rune"), |
477 | +-- inventory_image = "mobs_protector.png", |
478 | +-- groups = {flammable = 2} |
479 | +--}) |
480 | +-- |
481 | +--minetest.register_craft({ |
482 | +-- output = "mobs:protector", |
483 | +-- recipe = { |
484 | +-- { items.stone, items.stone, items.stone }, |
485 | +-- { items.stone, items.gold_block, items.stone }, |
486 | +-- { items.stone, items.stone, items.stone } |
487 | +-- } |
488 | +--}) |
489 | +-- |
490 | +---- level 2 protection rune |
491 | +--minetest.register_craftitem("mobs:protector2", { |
492 | +-- description = S("Mob Protection Rune (Level 2)"), |
493 | +-- inventory_image = "mobs_protector2.png", |
494 | +-- groups = {flammable = 2} |
495 | +--}) |
496 | +-- |
497 | +--minetest.register_craft({ |
498 | +-- output = "mobs:protector2", |
499 | +-- recipe = { |
500 | +-- { "mobs:protector", items.mese_crystal, "mobs:protector" }, |
501 | +-- { items.mese_crystal, items.diamond_block, items.mese_crystal }, |
502 | +-- { "mobs:protector", items.mese_crystal, "mobs:protector" } |
503 | +-- } |
504 | +--}) |
505 | +-- |
506 | +---- saddle |
507 | +--minetest.register_craftitem("mobs:saddle", { |
508 | +-- description = S("Saddle"), |
509 | +-- inventory_image = "mobs_saddle.png", |
510 | +-- groups = {flammable = 2, saddle = 1} |
511 | +--}) |
512 | +-- |
513 | +--minetest.register_craft({ |
514 | +-- output = "mobs:saddle", |
515 | +-- recipe = { |
516 | +-- {"mobs:leather", "mobs:leather", "mobs:leather"}, |
517 | +-- {"mobs:leather", items.steel_ingot, "mobs:leather"}, |
518 | +-- {"mobs:leather", items.steel_ingot, "mobs:leather"} |
519 | +-- } |
520 | +--}) |
521 | +-- |
522 | +-- |
523 | +---- make sure we can register fences |
524 | +--local mod_def = minetest.get_modpath("default") |
525 | +-- |
526 | +--if mod_def and default.register_fence then |
527 | +-- |
528 | +---- mob fence (looks like normal fence but collision is 2 high) |
529 | +--default.register_fence("mobs:fence_wood", { |
530 | +-- description = S("Mob Fence"), |
531 | +-- texture = "default_wood.png", |
532 | +-- material = "default:fence_wood", |
533 | +-- groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, |
534 | +-- sounds = mod_def and default.node_sound_wood_defaults(), |
535 | +-- collision_box = { |
536 | +-- type = "fixed", |
537 | +-- fixed = { |
538 | +-- {-0.5, -0.5, -0.5, 0.5, 1.9, 0.5}, |
539 | +-- } |
540 | +-- } |
541 | +--}) |
542 | +--end |
543 | +-- |
544 | +---- mob fence top (has enlarged collisionbox to stop mobs getting over) |
545 | +--minetest.register_node("mobs:fence_top", { |
546 | +-- description = S("Mob Fence Top"), |
547 | +-- drawtype = "nodebox", |
548 | +-- tiles = {"default_wood.png"}, |
549 | +-- paramtype = "light", |
550 | +-- is_ground_content = false, |
551 | +-- groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, |
552 | +-- sounds = mod_def and default.node_sound_wood_defaults(), |
553 | +-- node_box = { |
554 | +-- type = "fixed", |
555 | +-- fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2} |
556 | +-- }, |
557 | +-- collision_box = { |
558 | +-- type = "fixed", |
559 | +-- fixed = {-0.4, -1.5, -0.4, 0.4, 0, 0.4} |
560 | +-- }, |
561 | +-- selection_box = { |
562 | +-- type = "fixed", |
563 | +-- fixed = {-0.4, -1.5, -0.4, 0.4, 0, 0.4} |
564 | +-- } |
565 | +--}) |
566 | +-- |
567 | +--minetest.register_craft({ |
568 | +-- output = "mobs:fence_top 12", |
569 | +-- recipe = { |
570 | +-- {"group:wood", "group:wood", "group:wood"}, |
571 | +-- {"", items.fence_wood, ""} |
572 | +-- } |
573 | +--}) |
574 | +-- |
575 | +-- |
576 | +---- items that can be used as fuel |
577 | +--minetest.register_craft({ |
578 | +-- type = "fuel", |
579 | +-- recipe = "mobs:nametag", |
580 | +-- burntime = 3 |
581 | +--}) |
582 | +-- |
583 | +--minetest.register_craft({ |
584 | +-- type = "fuel", |
585 | +-- recipe = "mobs:lasso", |
586 | +-- burntime = 7 |
587 | +--}) |
588 | +-- |
589 | +--minetest.register_craft({ |
590 | +-- type = "fuel", |
591 | +-- recipe = "mobs:net", |
592 | +-- burntime = 8 |
593 | +--}) |
594 | +-- |
595 | +--minetest.register_craft({ |
596 | +-- type = "fuel", |
597 | +-- recipe = "mobs:leather", |
598 | +-- burntime = 4 |
599 | +--}) |
600 | +-- |
601 | +--minetest.register_craft({ |
602 | +-- type = "fuel", |
603 | +-- recipe = "mobs:saddle", |
604 | +-- burntime = 7 |
605 | +--}) |
606 | +-- |
607 | +--minetest.register_craft({ |
608 | +-- type = "fuel", |
609 | +-- recipe = "mobs:fence_wood", |
610 | +-- burntime = 7 |
611 | +--}) |
612 | +-- |
613 | +--minetest.register_craft({ |
614 | +-- type = "fuel", |
615 | +-- recipe = "mobs:fence_top", |
616 | +-- burntime = 2 |
617 | +--}) |
618 | +-- |
619 | +-- |
620 | +---- this tool spawns same mob and adds owner, protected, nametag info |
621 | +---- then removes original entity, this is used for fixing any issues. |
622 | +---- also holding sneak while punching mob lets you change texture name. |
623 | +-- |
624 | +--local tex_obj |
625 | +-- |
626 | +--minetest.register_tool(":mobs:mob_reset_stick", { |
627 | +-- description = S("Mob Reset Stick"), |
628 | +-- inventory_image = "default_stick.png^[colorize:#ff000050", |
629 | +-- stack_max = 1, |
630 | +-- groups = {not_in_creative_inventory = 1}, |
631 | +-- |
632 | +-- on_use = function(itemstack, user, pointed_thing) |
633 | +-- |
634 | +-- if pointed_thing.type ~= "object" then |
635 | +-- return |
636 | +-- end |
637 | +-- |
638 | +-- local obj = pointed_thing.ref |
639 | +-- |
640 | +-- local control = user:get_player_control() |
641 | +-- local sneak = control and control.sneak |
642 | +-- |
643 | +-- -- spawn same mob with saved stats, with random texture |
644 | +-- if obj and not sneak then |
645 | +-- |
646 | +-- local self = obj:get_luaentity() |
647 | +-- local obj2 = minetest.add_entity(obj:get_pos(), self.name) |
648 | +-- |
649 | +-- if obj2 then |
650 | +-- |
651 | +-- local ent2 = obj2:get_luaentity() |
652 | +-- |
653 | +-- ent2.protected = self.protected |
654 | +-- ent2.owner = self.owner |
655 | +-- ent2.nametag = self.nametag |
656 | +-- ent2.gotten = self.gotten |
657 | +-- ent2.tamed = self.tamed |
658 | +-- ent2.health = self.health |
659 | +-- ent2.order = self.order |
660 | +-- |
661 | +-- if self.child then |
662 | +-- obj2:set_velocity({x = 0, y = self.jump_height, z = 0}) |
663 | +-- end |
664 | +-- |
665 | +-- obj2:set_properties({nametag = self.nametag}) |
666 | +-- |
667 | +-- obj:remove() |
668 | +-- end |
669 | +-- end |
670 | +-- |
671 | +-- -- display form to enter texture name ending in .png |
672 | +-- if obj and sneak then |
673 | +-- |
674 | +-- tex_obj = obj |
675 | +-- |
676 | +-- -- get base texture |
677 | +-- local bt = tex_obj:get_luaentity().base_texture[1] |
678 | +-- |
679 | +-- if type(bt) ~= "string" then |
680 | +-- bt = "" |
681 | +-- end |
682 | +-- |
683 | +-- local name = user:get_player_name() |
684 | +-- |
685 | +-- minetest.show_formspec(name, "mobs_texture", "size[8,4]" |
686 | +-- .. "field[0.5,1;7.5,0;name;" |
687 | +-- .. FS("Enter texture:") .. ";" .. bt .. "]" |
688 | +-- .. "button_exit[2.5,3.5;3,1;mob_texture_change;" |
689 | +-- .. FS("Change") .. "]") |
690 | +-- end |
691 | +-- end |
692 | +--}) |
693 | +-- |
694 | +--minetest.register_on_player_receive_fields(function(player, formname, fields) |
695 | +-- |
696 | +-- -- right-clicked with nametag and name entered? |
697 | +-- if formname == "mobs_texture" |
698 | +-- and fields.name |
699 | +-- and fields.name ~= "" then |
700 | +-- |
701 | +-- -- does mob still exist? |
702 | +-- if not tex_obj |
703 | +-- or not tex_obj:get_luaentity() then |
704 | +-- return |
705 | +-- end |
706 | +-- |
707 | +-- -- make sure nametag is being used to name mob |
708 | +-- local item = player:get_wielded_item() |
709 | +-- |
710 | +-- if item:get_name() ~= "mobs:mob_reset_stick" then |
711 | +-- return |
712 | +-- end |
713 | +-- |
714 | +-- -- limit name entered to 64 characters long |
715 | +-- if fields.name:len() > 64 then |
716 | +-- fields.name = fields.name:sub(1, 64) |
717 | +-- end |
718 | +-- |
719 | +-- -- update texture |
720 | +-- local self = tex_obj:get_luaentity() |
721 | +-- |
722 | +-- self.base_texture = {fields.name} |
723 | +-- |
724 | +-- tex_obj:set_properties({textures = {fields.name}}) |
725 | +-- |
726 | +-- -- reset external variable |
727 | +-- tex_obj = nil |
728 | +-- end |
729 | +--end) |
730 | +-- |
731 | +-- |
732 | +---- Meat Block |
733 | +--minetest.register_node("mobs:meatblock", { |
734 | +-- description = S("Meat Block"), |
735 | +-- tiles = {"mobs_meat_top.png", "mobs_meat_bottom.png", "mobs_meat_side.png"}, |
736 | +-- paramtype2 = "facedir", |
737 | +-- groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2}, |
738 | +-- sounds = mod_def and default.node_sound_leaves_defaults(), |
739 | +-- on_place = minetest.rotate_node, |
740 | +-- on_use = minetest.item_eat(20) |
741 | +--}) |
742 | +-- |
743 | +--minetest.register_craft({ |
744 | +-- output = "mobs:meatblock", |
745 | +-- recipe = { |
746 | +-- { items.meat_cooked, items.meat_cooked, items.meat_cooked }, |
747 | +-- { items.meat_cooked, items.meat_cooked, items.meat_cooked }, |
748 | +-- { items.meat_cooked, items.meat_cooked, items.meat_cooked } |
749 | +-- } |
750 | +--}) |
751 | +-- |
752 | +---- Meat Block (raw) |
753 | +--minetest.register_node("mobs:meatblock_raw", { |
754 | +-- description = S("Raw Meat Block"), |
755 | +-- tiles = {"mobs_meat_raw_top.png", "mobs_meat_raw_bottom.png", "mobs_meat_raw_side.png"}, |
756 | +-- paramtype2 = "facedir", |
757 | +-- groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2}, |
758 | +-- sounds = mod_def and default.node_sound_leaves_defaults(), |
759 | +-- on_place = minetest.rotate_node, |
760 | +-- on_use = minetest.item_eat(20) |
761 | +--}) |
762 | +-- |
763 | +--minetest.register_craft({ |
764 | +-- output = "mobs:meatblock_raw", |
765 | +-- recipe = { |
766 | +-- { items.meat_raw, items.meat_raw, items.meat_raw }, |
767 | +-- { items.meat_raw, items.meat_raw, items.meat_raw }, |
768 | +-- { items.meat_raw, items.meat_raw, items.meat_raw } |
769 | +-- } |
770 | +--}) |
771 | +-- |
772 | +--minetest.register_craft({ |
773 | +-- type = "cooking", |
774 | +-- output = "mobs:meatblock", |
775 | +-- recipe = "mobs:meatblock_raw", |
776 | +-- cooktime = 30 |
777 | +--}) |
778 | +-- |
779 | -- |
780 | 2.43.0 |
781 |
|