Skip to content

Commit

Permalink
Fixed and Tweaks for Playtest
Browse files Browse the repository at this point in the history
  • Loading branch information
gtnardy committed Oct 30, 2022
1 parent e85c337 commit 09c3ae4
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 49 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/nanos-world-store.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: halloween publish to store.nanos.world

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
name: Publish package
steps:
- uses: actions/checkout@v2
- name: Nanos Store Action
uses: nanos-world/[email protected]
with:
# folder which contains the asset/package - if it's on root, leave it blank
folder: ''
# name of the asset/package
name: 'halloween'
# changelog of the release - can be edited on the store before it gets published
changelog: 'built through actions'
# API token - generate at https://store.nanos.world/settings/tokens/ and set under Settings -> Secrets -> Actions with name STORE_SECRET
token: ${{ secrets.STORE_SECRET }}
9 changes: 6 additions & 3 deletions Client/Index.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Halloween = {
-- Stores the UI Instance
HUD = nil

-- Disable Debug settings
Client.SetDebugEnabled(false)

-- Creates a WebUI for the Inventory when the package loads
Package.Subscribe("Load", function()
HUD = WebUI("HUD", "file:///UI/index.html")
Expand Down Expand Up @@ -44,7 +47,7 @@ end)

-- Configures Keybindings Inputs
Input.Register("HalloweenFlashlight", "F")
Input.Register("HalloweenSpecial", "Q")
Input.Register("HalloweenSpecial", "X")
Input.Register("SpectatePrev", "Left")
Input.Register("SpectateNext", "Right")
Input.Register("Unspectate", "SpaceBar")
Expand Down Expand Up @@ -82,7 +85,7 @@ end)

Input.Bind("Unspectate", InputEvent.Pressed, function()
if (Client.GetLocalPlayer():GetControlledCharacter()) then return end
Client.Unspectate()
Client.GetLocalPlayer():ResetCamera()
end)

-- Flick the Flashlight
Expand Down Expand Up @@ -300,7 +303,7 @@ end)

Events.Subscribe("TrapdoorOpened", function(trapdoor)
Halloween.is_trapdoor_opened = true
Sound(trapdoor:GetLocation(), "halloween-city-park::A_Hatch_Cue", false, false, SoundType.SFX, 2, 1, 1000, 25000, AttenuationFunction.Logarithmic, true)
Sound(trapdoor:GetLocation(), "halloween-city-park::A_Hatch_Cue", false, false, SoundType.SFX, 2, 1, 1000, 35000, AttenuationFunction.Logarithmic, true)
end)

Events.Subscribe("SurvivorEscaped", function()
Expand Down
6 changes: 4 additions & 2 deletions Client/UI/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
<img id="map" src="./images/map.jpg" />

<div id="players_heads">
<div id="survivor_heads"></div>
<div id="survivor_heads">
<!-- <span class="head survivor_head_alive"></span> -->
</div>
<div id="knight_heads"></div>
</div>

Expand All @@ -62,7 +64,7 @@
</div>
<div id="special">
<span id="special_cooldown">0</span>
<span id="special_label">SMELL (Q)</span>
<span id="special_label">SMELL (X)</span>
</div>

<div id="pumpkins_found"> 
Expand Down
1 change: 1 addition & 0 deletions Client/UI/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Events.Subscribe("ClearHUD", function() {
$("#label").html("");
$("#mvp").hide();
$("#label_big").html("");
$("#radar_inner").hide();

current_time = 0;
special_cooldown = 0;
Expand Down
18 changes: 11 additions & 7 deletions Client/UI/style.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
* {
margin: 0;
padding: 0;
}

body {
font-family: Roboto, sans-serif;
-webkit-user-select: none;
user-select: none;
margin: 0px;
padding: 0px;
background-size: 100%;
color: white;
}

#players_heads {
text-align: center;
margin-top: 25px;
position: absolute;
width: 100%;
}


.head {
display: inline-block;
width: 20px;
Expand Down Expand Up @@ -44,7 +47,8 @@ body {
}

#status_bar div {
background-color: #000000b8;
background-color: #0000003d;
border-radius: 5px;
display: inline-block;
height: 50px;
line-height: 50px;
Expand Down Expand Up @@ -87,7 +91,7 @@ body {

#label_big {
position: absolute;
top: 20%;
top: 100px;
color: white;
font-size: 60px;
width: 100%;
Expand Down Expand Up @@ -245,7 +249,7 @@ body {
#mvp {
text-align: center;
position: absolute;
top: 45%;
top: 200px;
width: 100%;
color: white;
display: none;
Expand Down
22 changes: 13 additions & 9 deletions Package.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# package configurations
[package]
# package name
name = "Halloween"
name = "Halloween"
# contributors
author = "nanos™"
author = "nanos™"
# version
version = "1.3.0"
version = "1.3.1"
# image URL
image = "https://i.imgur.com/WJDACbZ.jpg"
# package type: 'script' (normal package), 'game-mode' (unique package - can only load one at a time) or 'loading-screen' (special package loaded in loading screen)
type = "script"
# whether to force the custom map Script to do not load
force_no_map_script = false
image = "https://i.imgur.com/WJDACbZ.jpg"
# package type: 'script' (normal package), 'game-mode' (unique package - can only load one at a time), 'library' (doesn't start a Lua VM) or 'loading-screen' (special package for loading screen)
type = "game-mode"
# whether to force the custom map script to do not load
force_no_map_script = false
# auto destroy all entities spawned by this package when it unloads
auto_cleanup = true
auto_cleanup = true
# packages requirements
packages_requirements = [

Expand All @@ -22,3 +22,7 @@
assets_requirements = [
"halloween-city-park",
]
# compatible maps - maps to be highlighted when starting a new game through main menu
compatible_maps = [
"halloween-city-park::Halloween_CityPark",
]
101 changes: 73 additions & 28 deletions Server/Index.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,40 +197,46 @@ HalloweenSettings = {
return weapon
end,
pumpkin_spawn = function(location, rotation)
local pumpkin = Prop(location, rotation, "halloween-city-park::SM_Pumpkin_Lit", CollisionType.NoCollision, false, true, true)
local pumpkin = Prop(location, rotation, "halloween-city-park::SM_Pumpkin_Lit", CollisionType.NoCollision, false, GrabMode.Disabled, CCDMode.Disabled)

pumpkin:Subscribe("Interact", function(prop, character)
local player = character:GetPlayer()
if (not player:GetValue("IsAlive") or player:GetValue("Role") ~= ROLES.SURVIVOR) then return end
local pumpkin_light = Light(location + Vector(0, 0, 100), Rotator(), Color(1, 0.7, 0.4), LightType.Point, 1, 300, 44, 0, 1000, true, false)
pumpkin_light:AttachTo(pumpkin, AttachmentRule.KeepWorld, "", 0)

-- Picked up the Pumpkin, destroys it
local pumpkin_location = prop:GetLocation()
prop:Destroy()
local trigger = Trigger(location, Rotator(), Vector(200))
trigger:SetValue("Pumpkin", pumpkin)

if (Halloween.pumpkins_found > Halloween.total_pumpkins) then return false end
-- pumpkin:Subscribe("Interact", function(prop, character)
-- local player = character:GetPlayer()
-- if (not player:GetValue("IsAlive") or player:GetValue("Role") ~= ROLES.SURVIVOR) then return end

Halloween.pumpkins_found = Halloween.pumpkins_found + 1
-- -- Picked up the Pumpkin, destroys it
-- local pumpkin_location = prop:GetLocation()
-- prop:Destroy()

player:SetValue("PickedUpPumpkins", player:GetValue("PickedUpPumpkins", 0) + 1, true)
-- if (Halloween.pumpkins_found > Halloween.total_pumpkins) then return false end

Server.BroadcastChatMessage("The Survivor '" .. player:GetName() .. "' found a <green>Pumpkin</>! " .. (Halloween.total_pumpkins - Halloween.pumpkins_found) .. " remaining!")
Events.BroadcastRemote("PumpkinFound", pumpkin_location)
-- Halloween.pumpkins_found = Halloween.pumpkins_found + 1

-- If already found enough Pumpkins, opens the Door
if (Halloween.pumpkins_found >= Halloween.total_pumpkins) then
local trapdoor_location = Halloween.trapdoor:GetLocation()
local trapdoor_rotation = Halloween.trapdoor:GetRotation()
-- player:SetValue("PickedUpPumpkins", player:GetValue("PickedUpPumpkins", 0) + 1, true)

Halloween.trapdoor:Destroy()
Halloween.trapdoor = StaticMesh(trapdoor_location, trapdoor_rotation, "halloween-city-park::SM_Trapdoor_Opened", CollisionType.NoCollision)
Light(trapdoor_location + Vector(0, 0, 100), Rotator(), Color(0.73, 0.67, 0.42), 0, 10, 1000)
Halloween.is_trapdoor_opened = true
-- Server.BroadcastChatMessage("The Survivor '" .. player:GetName() .. "' found a <green>Pumpkin</>! " .. (Halloween.total_pumpkins - Halloween.pumpkins_found) .. " remaining!")
-- Events.BroadcastRemote("PumpkinFound", pumpkin_location)

Server.BroadcastChatMessage("A <green>Trapdoor</> has been opened! Survivors must find it to escape!")
Events.BroadcastRemote("TrapdoorOpened", Halloween.trapdoor)
end
return false
end)
-- -- If already found enough Pumpkins, opens the Door
-- if (Halloween.pumpkins_found >= Halloween.total_pumpkins) then
-- local trapdoor_location = Halloween.trapdoor:GetLocation()
-- local trapdoor_rotation = Halloween.trapdoor:GetRotation()

-- Halloween.trapdoor:Destroy()
-- Halloween.trapdoor = StaticMesh(trapdoor_location, trapdoor_rotation, "halloween-city-park::SM_Trapdoor_Opened", CollisionType.NoCollision)
-- Light(trapdoor_location + Vector(0, 0, 100), Rotator(), Color(0.73, 0.67, 0.42), 0, 10, 1000)
-- Halloween.is_trapdoor_opened = true

-- Server.BroadcastChatMessage("A <green>Trapdoor</> has been opened! Survivors must find it to escape!")
-- Events.BroadcastRemote("TrapdoorOpened", Halloween.trapdoor)
-- end
-- return false
-- end)
end,
entities_spawn = function()
-- Spawn Trapdoor
Expand Down Expand Up @@ -301,6 +307,41 @@ Trigger.Subscribe("BeginOverlap", function(trigger, actor_triggering)

return
end

-- Temp: If triggered Pumpkin
local pumpkin = trigger:GetValue("Pumpkin")
if (not Halloween.is_trapdoor_opened and pumpkin and pumpkin:IsValid()) then

-- Picked up the Pumpkin, destroys it
local pumpkin_location = pumpkin:GetLocation()
pumpkin:Destroy()
trigger:Destroy()

if (Halloween.pumpkins_found > Halloween.total_pumpkins) then return false end

player:SetValue("PickedUpPumpkins", player:GetValue("PickedUpPumpkins", 0) + 1, true)

Halloween.pumpkins_found = Halloween.pumpkins_found + 1

Server.BroadcastChatMessage("The Survivor '" .. player:GetName() .. "' found a <green>Pumpkin</>! " .. (Halloween.total_pumpkins - Halloween.pumpkins_found) .. " remaining!")
Events.BroadcastRemote("PumpkinFound", pumpkin_location)

-- If already found enough Pumpkins, opens the Door
if (Halloween.pumpkins_found >= Halloween.total_pumpkins) then
local location = Halloween.trapdoor:GetLocation()
local rotation = Halloween.trapdoor:GetRotation()

Halloween.trapdoor:Destroy()
Halloween.trapdoor = StaticMesh(location, rotation, "halloween-city-park::SM_Trapdoor_Opened", CollisionType.NoCollision)
Light(location + Vector(0, 0, 100), Rotator(), Color(0.73, 0.67, 0.42), LightType.Point, 10, 1000)
Halloween.is_trapdoor_opened = true

Server.BroadcastChatMessage("A <green>Trapdoor</> has been opened! Survivors must find it to escape!")
Events.BroadcastRemote("TrapdoorOpened", Halloween.trapdoor)
end

return
end
end)

-- When player fully connects (custom event)
Expand Down Expand Up @@ -350,7 +391,11 @@ Player.Subscribe("Destroy", function (player)
character:SetHealth(0)
end

Server.BroadcastChatMessage("<green>" .. player:GetName() .. "</> has left the server")
if (Halloween.match_state == MATCH_STATES.WAITING_PLAYERS) then
Server.BroadcastChatMessage("<green>" .. player:GetName() .. "</> has left the server (" .. Player.GetCount() .. "/" .. HalloweenSettings.players_to_start .. ")")
else
Server.BroadcastChatMessage("<green>" .. player:GetName() .. "</> has left the server")
end
end)

Character.Subscribe("WeaponAimModeChanged", function(character, old_state, new_state)
Expand All @@ -366,7 +411,7 @@ Character.Subscribe("WeaponAimModeChanged", function(character, old_state, new_s
light:SetRelativeRotation(Rotator(0, 87, 0))
elseif (old_state == AimMode.None) then
light:AttachTo(weapon, AttachmentRule.SnapToTarget, "muzzle")
light:SetRelativeLocation(Vector(-50, -10, 5))
light:SetRelativeLocation(Vector(-40, -10, 5))
end
end
end)
Expand Down Expand Up @@ -564,7 +609,7 @@ function SpawnCharacter(player)
character:SetCanDrop(false)

-- Survivor light
local my_light = Light(Vector(), Rotator(), Color(0.97, 0.76, 0.46), LightType.Spot, 0.15, 6000, 25, 0.95, 15000, false, true, true)
local my_light = Light(Vector(), Rotator(), Color(0.97, 0.76, 0.46), LightType.Spot, 0.15, 6000, 30, 0.95, 15000, false, true, true)
my_light:SetValue("Enabled", true)
my_light:SetTextureLightProfile(LightProfile.Shattered_02)
my_light:AttachTo(character, AttachmentRule.SnapToTarget, "head")
Expand Down

0 comments on commit 09c3ae4

Please sign in to comment.