Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AI/population/UpdateAgent.gd
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func removeAgent(i, j):
for agent in ActiveAgents:
if (agent.residential_tile.i == i && agent.residential_tile.j == j):
var currTile = agent.residential_tile
currTile.remove_people(1)
#currTile.remove_people(1)
agent.removeJob()
ActiveAgents.erase(agent)
break
Expand All @@ -54,7 +54,7 @@ func onRemovedTile(i, j):
for agent in ActiveAgents:
if (agent.residential_tile.i == i && agent.residential_tile.j == j):
var currTile = agent.residential_tile
currTile.remove_people(1)
#currTile.remove_people(1)
agent.removeJob()
ActiveAgents.erase(agent)
if (agent.commercial_tile != null):
Expand Down
3 changes: 2 additions & 1 deletion AI/population/can_find_job_leaf.gd
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ func _tick(agent: Node, blackboard: Blackboard) -> bool:

if current_agent.months_passed > 6:
var currTile = current_agent.residential_tile
currTile.remove_people(1)
currTile.move_people_out(1)
UpdatePopulation.change_residents(-1)
UpdateAgent.ActiveAgents.erase(current_agent)

# updates queue
Expand Down
3 changes: 2 additions & 1 deletion AI/population/cannot_find_job_leaf.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ func _tick(agent: Node, blackboard: Blackboard) -> bool:

if current_agent.months_passed > 6:
var currTile = current_agent.residential_tile
currTile.remove_people(1)
currTile.move_people_out(1)
UpdatePopulation.change_residents(-1)
UpdateAgent.ActiveAgents.erase(current_agent)

# updates queue
Expand Down
2 changes: 1 addition & 1 deletion AI/population/is_happy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func _pre_tick(agent: Node, blackboard: Blackboard) -> void:
var status = currTile.get_status()
var selectTile = BASE_STAY_CHANCE * (currTile.landValue + currTile.happiness)
if (!currTile.has_utilities()):
leaveChance += NO_UTILITIES_UNHAPPINESS
leaveChance += NO_UTILITIES_UNHAPPINESS
if (status == Tile.TileStatus.LIGHT_DAMAGE || status == Tile.TileStatus.MEDIUM_DAMAGE):
leaveChance += DAMAGE_UNHAPPINESS
elif (status == Tile.TileStatus.HEAVY_DAMAGE):
Expand Down
16 changes: 8 additions & 8 deletions AI/population/is_unhappy_leaf.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,37 @@ var rng = RandomNumberGenerator.new()
func _tick(agent: Node, blackboard: Blackboard) -> bool:
var current_agent = blackboard.get_data("queue").pop_front()
#Agent will move if they are unhappy or leave the city
var mapHeight = Global.mapHeight
var mapWidth = Global.mapWidth
var moved = false

# iterates through the map to find possible living spaces
for i in mapHeight:
for j in mapWidth:
for key in Global.activeTiles:
if moved == false:
var current_tile = Global.tileMap[i][j]
var maxRange = current_tile.landValue + current_tile.happiness
var current_tile = Global.tileMap[key[0]][key[1]]
var maxRange = current_tile.happiness + current_tile.landValue
var selectTile = BASE_MOVE_CHANCE * (current_tile.landValue + current_tile.happiness)

if current_tile.zone == Tile.TileZone.MULTI_FAMILY || current_tile.zone == Tile.TileZone.SINGLE_FAMILY:
if current_tile.has_utilities() && current_tile.tileDamage == 0:
rng.randomize()
# if living space is suitable and chance of moving allows for move to happen, move agent
if (selectTile > rng.randf_range(0, maxRange)):
if (selectTile > rng.randf_range(0,maxRange)):
current_agent.change_residence(current_tile)
moved = true
break

# if no suitable living space, agent leaves city
if moved == false:
print("agent left city")
var currTile = current_agent.residential_tile
currTile.remove_people(1)
currTile.move_people_out(1)
UpdatePopulation.change_residents(-1)

var currWorkTile = current_agent.commercial_tile
if currWorkTile != null:
current_agent.removeJob()
#currWorkTile.remove_people(1)
UpdateAgent.ActiveAgents.erase(current_agent)
print("agents:", UpdateAgent.ActiveAgents.size())

# updates queue
check_empty(blackboard)
Expand Down
Binary file added assets/characters/Clark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/characters/Clark.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Clark.png-4dd79fbb734ae1b27b7abf1df35fab29.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/characters/Clark.png"
dest_files=[ "res://.import/Clark.png-4dd79fbb734ae1b27b7abf1df35fab29.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added assets/characters/Clark_unlocked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/characters/Clark_unlocked.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Clark_unlocked.png-5e09d13f6665549204305723bda47e82.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/characters/Clark_unlocked.png"
dest_files=[ "res://.import/Clark_unlocked.png-5e09d13f6665549204305723bda47e82.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file modified assets/characters/Jermaine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/characters/Jermaine.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Jermaine.svg-63777cf9bbcfe5c28acc27d1ab2ff1ed.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/characters/Jermaine.svg"
dest_files=[ "res://.import/Jermaine.svg-63777cf9bbcfe5c28acc27d1ab2ff1ed.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added assets/characters/Jermaine_unlocked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/characters/Jermaine_unlocked.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Jermaine_unlocked.png-f8fbadea2e97bd1d83eb3efaa6adccf0.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/characters/Jermaine_unlocked.png"
dest_files=[ "res://.import/Jermaine_unlocked.png-f8fbadea2e97bd1d83eb3efaa6adccf0.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added assets/characters/Judith.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/characters/Judith.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Judith.png-01de32655fe25d87f875392661e296a9.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/characters/Judith.png"
dest_files=[ "res://.import/Judith.png-01de32655fe25d87f875392661e296a9.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added assets/characters/Judith_unlocked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/characters/Judith_unlocked.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Judith_unlocked.png-60cded93511a070aa741f09e2ee077ee.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/characters/Judith_unlocked.png"
dest_files=[ "res://.import/Judith_unlocked.png-60cded93511a070aa741f09e2ee077ee.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file removed assets/characters/judth.png
Binary file not shown.
Binary file modified assets/office/Clark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/office/Judith.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/office/Judith.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Judith.png-309490ce4c1bee6f463be2e9396d9c4f.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/office/Judith.png"
dest_files=[ "res://.import/Judith.png-309490ce4c1bee6f463be2e9396d9c4f.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
4 changes: 2 additions & 2 deletions scripts/NPCOrganizer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ var npcCount: int = 0
#Called only once to intialize the NPCs
func _ready():
addNPC("PLAYER_NAME", "Mayor", 0, "res://assets/characters/test_profession_icon.png", "")
addNPC("Jermaine", "Deputy Mayor", 1, "res://assets/characters/Jermaine.png", "I am a deputy mayor!")
addNPC("Judith","Researcher", 2, "res://assets/characters/judth.png", "I am a researcher!")
addNPC("Jermaine", "Deputy Mayor", 1, "res://assets/characters/Jermaine.png", "A deputy mayor assists the mayor in matters of running the city. He chairs council meetings, liaisons with the community, and acts on behalf of the mayor.")
addNPC("Judith","Researcher", 2, "res://assets/characters/Judith.png", "I am a researcher!")
addNPC("Clark", "Environmental Engineer", 3, "res://assets/characters/scientist_icon.png", "I am an environmental engineer!")
#addNPC("Test Name","Test Profession", 4, "res://assets/characters/test_profession_icon.png", "I am definitely something!")

Expand Down
2 changes: 1 addition & 1 deletion scripts/Office.gd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func _on_QuitOffice_button_down():
func _on_Phone_pressed():
var phone = preload("res://ui/hud/NPC_Interactions/Phone.tscn")
var phone_instance = phone.instance()
add_child(phone_instance)
get_tree().get_current_scene().add_child(phone_instance)

# opens sensor graphs
func _on_Computer_pressed():
Expand Down
7 changes: 2 additions & 5 deletions scripts/Phone.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extends Node2D
extends CanvasLayer

#stores the current npc from clicked character card
var currNPC
Expand All @@ -17,10 +17,7 @@ func _npc_callback(npc_character):
$phone_info/photo.texture = load(picPath)
$phone_info/name.text = currNPC.name
$phone_info/job.text = currNPC.job
if currNPC.name !="Jermaine":
$phone_info/jobdesc.text = "No information available at the moment. Please check later!"
else:
$phone_info/jobdesc.text = "A deputy mayor assists the mayor in matters of running the city. He chairs council meetings, liaisons with the community, and acts on behalf of the mayor."
$phone_info/jobdesc.text = currNPC.description
$phone_info/fee.text = str("You can consult with ",currNPC.name, " for free.")
$phone_info.visible = true
$ScrollContainer.visible = false
Expand Down
Loading