Differences From
Artifact [4e5c236dfa]:
- File
runeforge.lua
— part of check-in
[15f176a7fe]
at
2020-10-31 19:49:49
on branch trunk
— add background noise for condensers (temporary hack, need to write a proper environment sound framework as the fucking env_sounds module is completely impossible to extend), fix a couple of really stupid bugs, make higher-quality phials increase the chance of getting good runes so it's not a complete waste to burn iridium or levitanium powder on making them, add targeted disjunction and some other amulet spells
(user:
lexi,
size: 17874)
[annotate]
[blame]
[check-ins using]
1 1 -- TODO make some kind of disposable "filter" tool that runeforges require
2 2 -- to generate runes and that wears down over time, to make amulets more
3 3 -- expensive than they currently are? the existing system is neat but
4 4 -- i think amulets are a little overpowered for something that just
5 5 -- passively consumes ley-current
6 +-- -- are phials & rune-wrenches enough for this now?
6 7
7 8 local constants = {
8 9 rune_mine_interval = 240;
9 10 -- how often a powered forge rolls for new runes
10 11
11 12 rune_cache_max = 4;
12 13 -- how many runes a runeforge can hold at a time
................................................................................
44 45 local fac = (g-1) / 5
45 46 return i - ((i*0.5) * fac), 0.5 * fac
46 47 end
47 48 sorcery.register.runes.foreach('sorcery:generate',{},function(name,rune)
48 49 local id = 'sorcery:rune_' .. name
49 50 rune.image = rune.image or string.format('sorcery_rune_%s.png',name)
50 51 rune.item = id
52 + local c = sorcery.lib.color(rune.tone)
51 53 minetest.register_craftitem(id, {
52 - description = sorcery.lib.color(rune.tone):readable():fmt(rune.name .. ' Rune');
54 + description = c:darken(0.7):bg(c:readable():fmt(rune.name .. ' Rune'));
53 55 short_description = rune.name .. ' Rune';
54 56 inventory_image = rune.image;
55 57 stack_max = 1;
56 58 groups = {
57 59 sorcery_rune = 1;
58 60 not_in_creative_inventory = 1;
59 61 };
................................................................................
145 147 local rp = rune:get_definition()._proto
146 148 local rg = rune:get_meta():get_int('rune_grade')
147 149 m:set_string('amulet_rune', rp.id)
148 150 m:set_int('amulet_rune_grade', rg)
149 151 local spell = sorcery.amulet.getspell(stack)
150 152 if not spell then return nil end
151 153 local name
152 - if spell.minrune then -- indicating quality makes less sense if it's restricted
154 + if spell.mingrade and spell.mingrade > 0 then -- indicating quality makes less sense if it's restricted
153 155 name = string.format('Amulet of %s', spell.name)
154 156 else
155 157 name = string.format('Amulet of %s %s', constants.amulet_grades[rg], spell.name)
156 158 end
157 159 m:set_string('description', sorcery.lib.ui.tooltip {
158 160 title = name;
159 161 color = spell.tone;
................................................................................
403 405 local i = m:get_inventory()
404 406 i:set_size('cache',constants.rune_cache_max)
405 407 i:set_size('wrench',1) i:set_size('phial',1) i:set_size('refuse',1)
406 408 i:set_size('amulet',1) i:set_size('active',1)
407 409 m:set_string('infotext','Rune Forge')
408 410 runeforge_update(pos)
409 411 end;
410 - after_dig_node = sorcery.lib.node.purge_only {'amulet'};
412 + after_dig_node = sorcery.lib.node.purge_only {'amulet','wrench'};
411 413 on_timer = runeforge_update;
412 414 on_metadata_inventory_move = function(pos, fl,fi, tl,ti, count, user)
413 415 local inv = minetest.get_meta(pos):get_inventory()
414 416 local wrench if not inv:is_empty('wrench') then
415 417 wrench = inv:get_stack('wrench',1):get_definition()._proto
416 418 end
417 419 local wwear = function(cap)