[WIP] Virus mod

yaman
Member
 
Posts: 56
Joined: Wed Sep 04, 2013 21:22

[WIP] Virus mod

by yaman » Mon Feb 03, 2014 03:02

I am creating a mod where you can craft a block that takes over your world, I need some textures, the link to the texture requests is here. I will try to upload screenshots as soon as I have something worth showing.

Questions:
1. How to register a node that is unbreakable?
2. for this code, how to make it so that neigbors are all blocks? Do I just delete that line or do I put something there?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_abm({
    nodenames = {"virus:corrupted_block"},
    neighbors = {"default:dirt"},
    interval = 5,
    chance = 1,
    action = function(pos, node, active_object_count, active_object_count_wider)
        minetest.set_node(pos, {name = "virus:corrupted_block"})
    end,
})

3. How do I make a schematic (see instabuild or something) ? I need this because the only purified block is going to be inside, and i need this building to spawn somewhere random in the currupted region



Corrupted Block for now: (NOT PERMANENT!!!)
Image
Last edited by yaman on Mon Feb 03, 2014 03:27, edited 1 time in total.
 

User avatar
Dopium
Member
 
Posts: 233
Joined: Sat Jun 09, 2012 15:43

by Dopium » Mon Feb 03, 2014 10:57

1) The lua_api found in minetest/docs explains how to make nodes unbreakable.

2) You may want to look into how dirt with grass works.
Running @1.19 MHz, 128 bytes of RAM and interchangeable 4kb ROM carts!
 

yaman
Member
 
Posts: 56
Joined: Wed Sep 04, 2013 21:22

by yaman » Mon Feb 03, 2014 21:58

Ok another question, Is there a group that is all nodes, like opposite of nil?
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Tue Feb 04, 2014 11:24

yaman wrote:Ok another question, Is there a group that is all nodes, like opposite of nil?

sure, like

node ~= nil

done
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

Grissess
Member
 
Posts: 11
Joined: Tue Feb 04, 2014 00:14

by Grissess » Tue Feb 04, 2014 16:35

yaman wrote:Ok another question, Is there a group that is all nodes, like opposite of nil?


From https://github.com/celeron55/minetest/blob/master/doc/lua_api.txt :

neighbors = {"default:water_source", "default:water_flowing"}, -- (any of these)
^ If left out or empty, any neighbor will do


If you want to be sure that a node is actually a node (and not nothing), you might use node=minetest.get_node(pos), and then compare node.name to "air" (nothing) or "ignore" (not generated) :P
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Feb 04, 2014 18:09

 

yaman
Member
 
Posts: 56
Joined: Wed Sep 04, 2013 21:22

by yaman » Tue Feb 04, 2014 21:00

I am sorry, I wrote my question wrong, what I meant to say is for registering abms, could the nodenames part select everything because
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
    nodenames = node ~= nil,
does not seem to work. Also for future developing, I am thinking of tree corrupted blocks, and cactus corrupted block so could I put something like
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
nodenames = if nodename = default.tree...
else...
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 4 guests

cron