Skip to content

Commit

Permalink
the rewilding (#12)
Browse files Browse the repository at this point in the history
* delete unused crow file

* initASL added

* prematurely bump version

* add boilerplate apiary

* add boilerpalte nb mixin

* remove duplicate condition

* unignore dev for now

* more boilerplate + get comfy for developing together

* nb first steps

* change periods to colons

* test commit

* broken: the nb_mixins need to be combined

* update displayed voice when changing NB VOICE

* made apiary glyph big and small

* --

* --

* --

* refactor

* refactor nb directory to only have lib

* update doc entry

* apiary animation v1

* swap voice and select in menu for visibility

* fixed nb voice menu display bug

* count nb voices manually during init

* added normalize velocity param for apiary

* fourth row into structures popup

* page indicator line 2px shorter

* remove dev scene

---------

Co-authored-by: Tyler Etters <[email protected]>
  • Loading branch information
entzmingerc and tyleretters authored Jul 21, 2024
1 parent 1c69c3e commit 2edbdc9
Show file tree
Hide file tree
Showing 19 changed files with 822 additions and 154 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
.DS_Store
.fuse*
lib/config_.lua
lib/dev.lua
4 changes: 2 additions & 2 deletions arcologies.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
-- k2: play k3: delete
--
--
-- v1.2.8
-- v1.3.0-dev

include("arcologies/lib/includes")

function init()
sharer.init()
audio:pitch_off()
structures.init()
filesystem.init()
Expand All @@ -31,6 +30,7 @@ function init()
popup.init()
keeper.init()
api.init()
nb:init()
arcology_name = "arcology" .. os.time(os.date("!*t"))
grid_dirty, screen_dirty, splash_break, arcology_loaded = false, false, false, false
keys, key_counter, enc_counter = {}, {{},{},{}}, {{},{},{}}
Expand Down
8 changes: 8 additions & 0 deletions lib/Cell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ function Cell:new(x, y, g)
state_index_mixin.init(self) -- alphabetically this is "I"
level_mixin.init(self)
metabolism_mixin.init(self)
nb_select_mixin.init(self)
nb_voice_mixin.init(self)
network_mixin.init(self)
notes_mixin.init(self)
offset_mixin.init(self)
Expand Down Expand Up @@ -62,6 +64,8 @@ function Cell:new(x, y, g)
c.setup_state_index(c) -- alphabetically this is "I"
c.setup_level(c)
c.setup_metabolism(c)
c.setup_nb_select(c)
c.setup_nb_voice(c)
c.setup_network(c)
c.setup_notes(c)
c.note_registrations(c)
Expand Down Expand Up @@ -225,6 +229,10 @@ function Cell:change_checks()
self:close_all_ports()
self:open_port(self:get_bearing_cardinal())

elseif self:is("APIARY") then
self:set_note_count(8)
self:setup_notes(8)

end
end

Expand Down
15 changes: 13 additions & 2 deletions lib/_crow.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
_crow = {}

function _crow.init()
crow.output[2].action = "pulse(.025, 5)"
crow.output[4].action = "pulse(.025, 5)"
initASL()
crow.ii.jf.mode(1)
end

Expand All @@ -16,9 +15,21 @@ function _crow:jf(note)
end

function _crow:play(note, pair)
initASL()
local output_pairs = {{1,2},{3,4}}
crow.output[output_pairs[pair][1]].volts = (note - 60) / 12
-- setting the action before triggering fixes the problem where
-- power cycling crow results in default ASL after arcologies has already initialized, better way?

crow.output[output_pairs[pair][2]]()
-- power cycle crow sets default ASL loaded on outputs, that's why only note is working
-- action is triggering on 2, there's just nothing there
-- reload script, it initializes crow output ASL actions
end

function initASL()
crow.output[2].action = "pulse(.025, 5)"
crow.output[4].action = "pulse(.025, 5)"
end

return _crow
4 changes: 2 additions & 2 deletions lib/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ config = {}

config["settings"] = {
["version_major"] = 1,
["version_minor"] = 2,
["version_patch"] = 8,
["version_minor"] = 3,
["version_patch"] = 0,
["playback"] = 0,
["length"] = 16,
["root"] = 0,
Expand Down
24 changes: 0 additions & 24 deletions lib/crow.lua

This file was deleted.

246 changes: 246 additions & 0 deletions lib/dev.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
local dev = {}

function rerun(option)
if option == 1 then
print("option 1")
end
norns.script.load(norns.state.script)
end

function r()
rerun()
end

function dev:scene(i)

if i == 1 then
page:select(2)
menu:select_item(4)
keeper:select_cell(8, 4)
keeper.selected_cell:open_port("w")
keeper:select_cell(4, 4)
keeper.selected_cell:change("APIARY")
keeper.selected_cell:open_port("n")
keeper.selected_cell:open_port("e")
keeper.selected_cell:open_port("s")
keeper.selected_cell:open_port("w")
-- keeper:deselect_cell()
-- test commit comment

elseif i == 2 then
sound:set_random_root()
sound:set_random_scale()
keeper:select_cell(4, 1)
keeper.selected_cell:open_port("s")
keeper:select_cell(4, 4)
keeper.selected_cell:change("AVIARY")
keeper.selected_cell:open_port("n")
-- keeper.selected_cell:open_port("e")
-- keeper.selected_cell:open_port("s")
-- keeper.selected_cell:open_port("w")
-- keeper.selected_cell:set_state_index(1)
page:select(2)
menu:select_item(1)
-- keeper:deselect_cell()
counters:toggle_playback()

elseif i == 3 then
-- fn.seed_cells()
counters:toggle_playback()
keeper:select_cell(1, 1)
keeper.selected_cell:open_port("e")
keeper.selected_cell:open_port("w")
keeper:deselect_cell()
keeper:select_cell(4, 1)
keeper.selected_cell:set_metabolism(1)
keeper.selected_cell:change("SOLARIUM")
keeper.selected_cell:open_port("e")
keeper.selected_cell:open_port("w")

page:select(2)




elseif i == 4 then
-- fn.seed_cells()
-- params:set("seed", 4)
-- fn.seed_cells()
page:select(4)

elseif i == 10 then
-- ode to joy
sound:set_scale(47)
page:select(2)
keeper:select_cell(1, 4)
keeper.selected_cell:open_port("e")
keeper.selected_cell:set_metabolism(16)

keeper:select_cell(5, 4)
keeper.selected_cell:open_port("n")
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(65) -- yeah these are very wrong


keeper:select_cell(6, 4)
keeper.selected_cell:open_port("n")
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(65) -- yeah these are very wrong

keeper:select_cell(7, 4)
keeper.selected_cell:open_port("n")
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(66) -- yeah these are very wrong

keeper:select_cell(8, 4)
keeper.selected_cell:open_port("n")
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(68) -- yeah these are very wrong

keeper:select_cell(9, 4)
keeper.selected_cell:open_port("n")
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(68) -- yeah these are very wrong

keeper:select_cell(10, 4)
keeper.selected_cell:open_port("n")
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(66) -- yeah these are very wrong

keeper:select_cell(11, 4)
keeper.selected_cell:open_port("n")
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(65) -- yeah these are very wrong

keeper:select_cell(12, 4)
keeper.selected_cell:open_port("n")
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("s")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(63) -- yeah these are very wrong

keeper:select_cell(12, 5)
keeper.selected_cell:open_port("n")
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("s")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(61) -- yeah these are very wrong

keeper:select_cell(11, 5)
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:open_port("s")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(61) -- yeah these are very wrong

keeper:select_cell(10, 5)
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:open_port("s")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(63) -- yeah these are very wrong

keeper:select_cell(9, 5)
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:open_port("s")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(65) -- yeah these are very wrong

keeper:select_cell(8, 5)
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:open_port("s")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(65) -- yeah these are very wrong

keeper:select_cell(7, 5)
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:open_port("s")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(63) -- yeah these are very wrong

keeper:select_cell(6, 5)
keeper.selected_cell:open_port("w")
keeper.selected_cell:open_port("e")
keeper.selected_cell:open_port("s")
keeper.selected_cell:change("SHRINE")
keeper.selected_cell:set_note(63) -- yeah these are very wrong

keeper:deselect_cell()


else
print('else block')

end
end


order = 0

-- thank you @dndrks
function screenshot()
--_norns.screen_export_png("/home/we/"..menu.."-"..os.time()..".png")
local which_screen = string.match(string.match(string.match(norns.state.script,"/home/we/dust/code/(.*)"),"/(.*)"),"(.+).lua")
_norns.screen_export_png("/home/we/dust/".. order .. "-" .. which_screen .. "-" .. os.time() .. ".png")
order = order + 1
end

function wtfscale()
for i = 1, #sound.scale_notes do
print(sound.scale_notes[i], mu.note_num_to_name(sound.scale_notes[i]))
end
end

function kc()
return keeper.selected_cell
end

function arcdebug()
print(" ")
print(" ")
print(" ")
print("start arcologies debug -------------------------------")
print(" ")
print("generated at: " .. os.date("%Y_%m_%d_%H_%M_%S") .. " / " .. os.time())
print("version: " .. fn.get_arcology_version())
print("root: " .. sound.root)
print("scale: " .. sound.scale_name)
print("cell count: " .. #keeper.cells)
print("signal count: " .. #keeper.signals)
print(" ")
print("cell census:")
for k,cell in pairs(keeper.cells) do
local coords = "x" .. cell.x .. "y" .. cell.y
print(coords, cell.id, cell.structure_value)
end
print(" ")
print("signal census:")
for k,signal in pairs(keeper.signals) do
local coords = "x" .. signal.x .. "y" .. signal.y
print(coords, signal.id, signal.heading)
end
print(" ")
print("end arcologies debug -------------------------------")
print(" ")
print(" ")
print(" ")
end

return dev
8 changes: 8 additions & 0 deletions lib/docs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,12 @@ docs.sheets["CLOAKROOM"] = {
"N & E ports: -"
}

docs.sheets["APIARY"] = {
"The nb library",
"plays notes well.",
"",
"Trigger sounds",
"with signals."
}

return docs
Loading

0 comments on commit 2edbdc9

Please sign in to comment.