diff options
| author | cheapie <no-email-for-you@example.com> | 2018-08-24 16:19:53 -0500 | 
|---|---|---|
| committer | cheapie <no-email-for-you@example.com> | 2018-08-24 16:19:53 -0500 | 
| commit | df75dc7b7ec03a3b30052efbea988c3ab2b8f430 (patch) | |
| tree | 60b9f3982ed111b7effcff5ff54eb7862997c732 /firealarm_hornstrobe | |
| download | firealarm-df75dc7b7ec03a3b30052efbea988c3ab2b8f430.tar firealarm-df75dc7b7ec03a3b30052efbea988c3ab2b8f430.tar.gz firealarm-df75dc7b7ec03a3b30052efbea988c3ab2b8f430.tar.bz2 firealarm-df75dc7b7ec03a3b30052efbea988c3ab2b8f430.tar.xz firealarm-df75dc7b7ec03a3b30052efbea988c3ab2b8f430.zip | |
Initial commit
Diffstat (limited to 'firealarm_hornstrobe')
| -rw-r--r-- | firealarm_hornstrobe/depends.txt | 1 | ||||
| -rw-r--r-- | firealarm_hornstrobe/init.lua | 99 | ||||
| -rw-r--r-- | firealarm_hornstrobe/sounds/firealarm_horn.ogg | bin | 0 -> 36602 bytes | |||
| -rw-r--r-- | firealarm_hornstrobe/textures/firealarm_hornstrobe_back.png | bin | 0 -> 146 bytes | |||
| -rw-r--r-- | firealarm_hornstrobe/textures/firealarm_hornstrobe_front_off.png | bin | 0 -> 274 bytes | |||
| -rw-r--r-- | firealarm_hornstrobe/textures/firealarm_hornstrobe_front_on.png | bin | 0 -> 1792 bytes | |||
| -rw-r--r-- | firealarm_hornstrobe/textures/firealarm_hornstrobe_side.png | bin | 0 -> 438 bytes | 
7 files changed, 100 insertions, 0 deletions
| diff --git a/firealarm_hornstrobe/depends.txt b/firealarm_hornstrobe/depends.txt new file mode 100644 index 0000000..d4798ab --- /dev/null +++ b/firealarm_hornstrobe/depends.txt @@ -0,0 +1 @@ +firealarm_common diff --git a/firealarm_hornstrobe/init.lua b/firealarm_hornstrobe/init.lua new file mode 100644 index 0000000..530734c --- /dev/null +++ b/firealarm_hornstrobe/init.lua @@ -0,0 +1,99 @@ +minetest.register_node(":firealarm:hornstrobe_off",{ +	description = "Fire Alarm Horn/Strobe", +	groups = { oddly_breakable_by_hand = 1 }, +	tiles = { +		"firealarm_hornstrobe_back.png", +		"firealarm_hornstrobe_back.png", +		"firealarm_hornstrobe_side.png", +		"firealarm_hornstrobe_side.png", +		"firealarm_hornstrobe_back.png", +		"firealarm_hornstrobe_front_off.png", +	}, +	paramtype = "light", +	paramtype2 = "facedir", +	drawtype = "nodebox", +	node_box = { +		type = "fixed", +		fixed = { +			{-0.15,-0.02,0.4,0.18,0.37,0.5}, +		}, +	}, +	on_punch = function(pos,_,player) +		local name = player:get_player_name() +		minetest.chat_send_player(name,string.format("Position: %d,%d,%d",pos.x,pos.y,pos.z)) +	end, +	after_place_node = function(pos) +		firealarm.setDevInfo("notification",pos,{strobeActive = false,hornActive = false}) +	end, +	after_dig_node = function(pos) +		firealarm.setDevInfo("notification",pos,nil) +	end, +}) + +local hornstrobeOnFrontTexture = "[combine:32x320".. +                                 ":0,0=firealarm_hornstrobe_front_on.png".. +                                 ":0,32=firealarm_hornstrobe_front_off.png".. +                                 ":0,64=firealarm_hornstrobe_front_off.png".. +                                 ":0,96=firealarm_hornstrobe_front_off.png".. +                                 ":0,128=firealarm_hornstrobe_front_off.png".. +                                 ":0,160=firealarm_hornstrobe_front_off.png".. +                                 ":0,192=firealarm_hornstrobe_front_off.png".. +                                 ":0,224=firealarm_hornstrobe_front_off.png".. +                                 ":0,256=firealarm_hornstrobe_front_off.png".. +                                 ":0,288=firealarm_hornstrobe_front_off.png" + +minetest.register_node(":firealarm:hornstrobe_on",{ +	drop = "firealarm:hornstrobe_off", +	description = "Fire Alarm Horn/Strobe (on state - you hacker you!)", +	groups = { oddly_breakable_by_hand = 1,not_in_creative_inventory = 1 }, +	tiles = { +		"firealarm_hornstrobe_back.png", +		"firealarm_hornstrobe_back.png", +		"firealarm_hornstrobe_side.png", +		"firealarm_hornstrobe_side.png", +		"firealarm_hornstrobe_back.png", +		{ +			name = hornstrobeOnFrontTexture, +			animation =  +			{ +				type = "vertical_frames", +				aspect_w = 32, +				aspect_h = 32, +				length = 1, +			}, +		} +	}, +	paramtype = "light", +	paramtype2 = "facedir", +	light_source = 8, +	use_texture_alpha = true, +	drawtype = "nodebox", +	node_box = { +		type = "fixed", +		fixed = { +			{-0.5,-0.5,0.4,0.5,0.5,0.401}, +			{-0.15,-0.02,0.4,0.18,0.37,0.5}, +		}, +	}, +}) + +minetest.register_abm({ +	label = "Update horn/strobe state", +	nodenames = {"firealarm:hornstrobe_off","firealarm:hornstrobe_on"}, +	interval = 4, +	chance = 1, +	action = function(pos,node) +		local devInfo = firealarm.getDevInfo("notification",pos) +		if not devInfo then return end +		if node.name == "firealarm:hornstrobe_off" and devInfo.strobeActive then +			node.name = "firealarm:hornstrobe_on" +			minetest.set_node(pos,node) +		elseif node.name == "firealarm:hornstrobe_on" and not devInfo.strobeActive then +			node.name = "firealarm:hornstrobe_off" +			minetest.set_node(pos,node) +		end +		if devInfo.hornActive then +			minetest.sound_play("firealarm_horn",{pos=pos}) +		end +	end, +}) diff --git a/firealarm_hornstrobe/sounds/firealarm_horn.ogg b/firealarm_hornstrobe/sounds/firealarm_horn.oggBinary files differ new file mode 100644 index 0000000..7ea565e --- /dev/null +++ b/firealarm_hornstrobe/sounds/firealarm_horn.ogg diff --git a/firealarm_hornstrobe/textures/firealarm_hornstrobe_back.png b/firealarm_hornstrobe/textures/firealarm_hornstrobe_back.pngBinary files differ new file mode 100644 index 0000000..4beaa00 --- /dev/null +++ b/firealarm_hornstrobe/textures/firealarm_hornstrobe_back.png diff --git a/firealarm_hornstrobe/textures/firealarm_hornstrobe_front_off.png b/firealarm_hornstrobe/textures/firealarm_hornstrobe_front_off.pngBinary files differ new file mode 100644 index 0000000..0033f4c --- /dev/null +++ b/firealarm_hornstrobe/textures/firealarm_hornstrobe_front_off.png diff --git a/firealarm_hornstrobe/textures/firealarm_hornstrobe_front_on.png b/firealarm_hornstrobe/textures/firealarm_hornstrobe_front_on.pngBinary files differ new file mode 100644 index 0000000..fdca07d --- /dev/null +++ b/firealarm_hornstrobe/textures/firealarm_hornstrobe_front_on.png diff --git a/firealarm_hornstrobe/textures/firealarm_hornstrobe_side.png b/firealarm_hornstrobe/textures/firealarm_hornstrobe_side.pngBinary files differ new file mode 100644 index 0000000..7f33a6d --- /dev/null +++ b/firealarm_hornstrobe/textures/firealarm_hornstrobe_side.png | 
