]> jfr.im git - irc/quakenet/lua-labspace.git/blobdiff - labspace.lua
Fix role message for alien kills.
[irc/quakenet/lua-labspace.git] / labspace.lua
index 638fec0157e1f8b0df36f0b3d913b048adeb7479..ff0b89c202ca37880e5a5c235098e3de65ddb8aa 100644 (file)
@@ -17,7 +17,7 @@
 
 -- TODO
 -- logging
--- make idle notifications independent from game delay
+-- vote info in !status
 
 -- Ideas:
 -- scientists vote on kills
@@ -461,6 +461,11 @@ function ls_cmd_hl(channel, numeric)
     return
   end
 
+  if string.lower(channel) ~= "#labspace" then
+    ls_notice(numeric, "Sorry, you can't use this command here.")
+    return
+  end
+
   ls_set_lasthl(channel, os.time())
 
   local numerics = {}
@@ -491,7 +496,7 @@ function ls_cmd_enable(channel, numeric)
     return
   end
 
-  ls_set_enabled(channel, false)
+  ls_set_enabled(channel, true)
   ls_notice(numeric, "Game has been enabled.")
 end
 
@@ -568,6 +573,14 @@ function ls_cmd_kill(numeric, victim)
     ls_set_guarded(channel, victimnumeric, false)
 
     ls_chanmsg(channel, "The attack on " .. ls_format_player(channel, victimnumeric) .. " was deflected by a force field. The force field generator has now run out of power.")
+  elseif ls_get_trait(channel, victimnumeric, "infested") then
+    ls_devoice_player(channel, numeric)
+    ls_devoice_player(channel, victimnumeric)
+    
+    ls_chanmsg(channel, "An alien bursts out of " .. ls_format_player(channel, victimnumeric, true) .. "'s chest just as " .. ls_format_player(channel, numeric, true) .. " was about to murder them, killing them both.")
+
+    ls_remove_player(channel, numeric, true)
+    ls_remove_player(channel, victimnumeric, true)
   else
     ls_devoice_player(channel, victimnumeric)
 
@@ -930,7 +943,7 @@ function ls_add_player(channel, numeric, forced)
     end
 
     if chanuser.opped then
-      ls_notice(channel, "You must not be opped to use this command.")
+      ls_notice(numeric, "You must not be opped to use this command.")
       return
     end
 
@@ -1235,6 +1248,13 @@ function ls_start_game(channel)
   ls_notice(force_owner, "You've found the \002force field generator\002. Use /notice " .. BOTNICK .. " guard <nick> to protect someone.")
   ls_notice(force_owner, "You are currently protecting yourself.")
 
+  -- make someone infested if there are at least 6 citizens
+  if table.getn(players) > 6 then
+    local infested_player = players[math.random(table.getn(players))]
+    ls_set_trait(channel, infested_player, "infested", true)
+    ls_notice(infested_player, "You're infested with an \002alien parasite\002.")
+  end
+  
   ls_chanmsg(channel, "Roles have been assigned: " ..
     table.getn(ls_get_players(channel, "scientist")) .. "x " .. ls_format_role("scientist") .. ", " ..
     table.getn(ls_get_players(channel, "investigator")) .. "x " .. ls_format_role("investigator") .. ", " ..
@@ -1267,10 +1287,12 @@ function ls_check_alive(channel)
   for _, player in pairs(ls_get_players(channel)) do
     local seen = ls_get_seen(channel, player)
 
-    if seen < os.time() - 120 then
-      table.insert(dead_players, player)
-    elseif seen < os.time() - 60 then
-      table.insert(idle_players, player)
+    if seen then
+      if seen < os.time() - 120 then
+        table.insert(dead_players, player)
+      elseif seen < os.time() - 60 then
+        table.insert(idle_players, player)
+      end
     end
   end