starlit  Diff

Differences From Artifact [2a09a8ef6e]:

To Artifact [c5d4cbc341]:


    11     11   		return string.format('starlit_tech:chem_lamp_%s',n)
    12     12   	end
    13     13   	local fab = starlit.type.fab {
    14     14   		element = { carbon = 8, magnesium = 2 };
    15     15   		cost = { power = 100 };
    16     16   		flag = { print = true };
    17     17   		time = { print = 5 };
    18         -		reverseEngineer = {
    19         -			complexity = 1;
    20         -			sw = 'starlit_tech:schematic_chem_lamp';
    21         -		};
    22     18   	};
    23     19   	for i = stages, 0, -1 do
    24     20   		minetest.register_node(chemLampID(i), {
    25     21   			short_description = 'Chem Lamp';
    26     22   			description = starlit.ui.tooltip {
    27     23   				title = 'Chem Lamp';
    28     24   				desc = "A simple carbon-frame chemical light source powered by ambient oxygen. Cheap, quick to print, and biodedragable, without any need for an electric grid or complex power storage mechanism. However, the light only lasts a few days, after which the lamp must be recycled or discarded.";
................................................................................
    30     26   				props = {
    31     27   					{title = 'Burn Remaining', desc=lib.math.timespec(stageTimeout * i), affinity=i > 4 and 'good' or 'bad'};
    32     28   					{title = 'Mass', desc='10g', affinity='info'};
    33     29   				};
    34     30   			};
    35     31   			drawtype = 'nodebox';
    36     32   			groups = {
    37         -				object = 2;
           33  +				object = 1;
    38     34   				attached_node = 1;
    39     35   			};
    40     36   			node_box = {
    41     37   				type = 'fixed';
    42     38   				fixed = {
    43     39   					-.4, -.5, -.20;
    44     40   					 .4, -.3,  .20;
................................................................................
    61     57   			on_timer = i ~= 0 and function(pos)
    62     58   				local me = minetest.get_node(pos)
    63     59   				minetest.swap_node(pos, {name=chemLampID(i-1), param2=me.param2})
    64     60   				return i > 1
    65     61   			end or nil;
    66     62   			_starlit = {
    67     63   				mass = 10;
    68         -				fab = fab;
           64  +				reverseEngineer = {
           65  +					complexity = 1;
           66  +					sw = 'starlit_tech:schematic_chem_lamp';
           67  +				};
    69     68   				recover = starlit.type.fab {
    70     69   					element = {
    71     70   						carbon = 8;
    72     71   						magnesium = math.floor(lib.math.lerp(i/stages, 0, 2));
    73     72   					};
    74     73   					time = {
    75     74   						shred = .5;
................................................................................
    89     88   		cost = {
    90     89   			cycles = 8e9;
    91     90   			ram = 16e6;
    92     91   		};
    93     92   		rarity = 1;
    94     93   	})
    95     94   end
           95  +
           96  +
           97  +minetest.register_node('starlit_tech:crate', {
           98  +	short_description = 'Crate';
           99  +	description = starlit.ui.tooltip {
          100  +		title = 'Crate';
          101  +		desc = 'A sturdy but lightweight storage crate made from solid carbon polymer.';
          102  +		props = { {title='Mass', affinity='info', desc='100g'} };
          103  +	};
          104  +	drawtype = 'nodebox';
          105  +	node_box = {
          106  +		type = 'fixed';
          107  +		fixed = {
          108  +			 .4,  .2,  .4;
          109  +			-.4, -.5, -.2;
          110  +		};
          111  +	};
          112  +	groups = {
          113  +		object = 3;
          114  +		attached_node = 3;
          115  +	};
          116  +	paramtype2 = 'facedir';
          117  +	tiles = {
          118  +		'starlit-tech-crate-top.png';
          119  +		'starlit-tech-crate-bottom.png';
          120  +
          121  +		'starlit-tech-crate-side.png^[transformFX';
          122  +		'starlit-tech-crate-side.png';
          123  +
          124  +		'starlit-tech-crate-back.png';
          125  +		'starlit-tech-crate-front.png';
          126  +	};
          127  +	_starlit = {
          128  +		mass = 100;
          129  +		reverseEngineer = {
          130  +			complexity = 1;
          131  +			sw = 'starlit_tech:schematic_crate';
          132  +		};
          133  +		recover = starlit.type.fab {
          134  +			element = { carbon = 100; };
          135  +			time = {
          136  +				shred = 1;
          137  +				shredPower = 3;
          138  +			};
          139  +		};
          140  +	};
          141  +	on_construct = function(pos)
          142  +		local m = minetest.get_meta(pos)
          143  +		local inv = m:get_inventory()
          144  +		inv:set_size('starlit:contents', 12)
          145  +	end;
          146  +	on_rightclick = function(pos, node, luser)
          147  +		if not luser then return end
          148  +		local user = starlit.activeUsers[luser:get_player_name()]
          149  +		user:openUI('starlit:box', 'index', {
          150  +			inv={
          151  +				{id = 'starlit:contents', pos=pos};
          152  +			};
          153  +		})
          154  +	end;
          155  +})
          156  +
          157  +starlit.item.sw.link('starlit_tech:schematic_crate', {
          158  +	name = 'Crate Schematic';
          159  +	kind = 'schematic';
          160  +	input = starlit.type.fab {
          161  +		element = { carbon = 100; };
          162  +		flag = {print = true};
          163  +		time = {print = 25};
          164  +		cost = {power = 250};
          165  +	};
          166  +	output = 'starlit_tech:crate';
          167  +	size = 48e6;
          168  +	cost = {
          169  +		cycles = 12e9;
          170  +		ram = 16e6;
          171  +	};
          172  +	rarity = 1;
          173  +})