Skip to content

Commit 2cfb5af

Browse files
Addressing some comments on beewrite PR.
1 parent cee2573 commit 2cfb5af

File tree

6 files changed

+43
-17
lines changed

6 files changed

+43
-17
lines changed

code/__defines/misc.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,3 +407,4 @@
407407
// In theory, one pollen every 5 seconds (at time of writing)
408408
#define POLLEN_PER_SECOND 0.2
409409
#define POLLEN_PRODUCTION_MULT (POLLEN_PER_SECOND * (SSplants.wait / 10))
410+
#define MAX_POLLEN_PER_FLOWER = 10

code/game/objects/structures/flora/plant.dm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
var/dead = FALSE
88
var/sampled = FALSE
99
var/datum/seed/plant
10-
var/harvestable = 0
10+
var/harvestable = 0 // Note that this is a counter, not a bool.
1111
var/pollen = 0
1212

1313
/obj/structure/flora/plant/large
@@ -17,7 +17,7 @@
1717
/obj/structure/flora/plant/Process()
1818
if(plant?.produces_pollen <= 0)
1919
return PROCESS_KILL
20-
if(pollen < 10)
20+
if(pollen < MAX_POLLEN_PER_FLOWER)
2121
pollen += plant.produces_pollen * POLLEN_PRODUCTION_MULT
2222

2323
/* Notes for future work moving logic off hydrotrays onto plants themselves:
@@ -164,6 +164,7 @@
164164
icon_state = "flower5"
165165
is_spawnable_type = TRUE
166166

167+
// Only contains roundstart plants, this is meant to be a mapping helper.
167168
/obj/structure/flora/plant/random_flower/proc/get_flower_variants()
168169
var/static/list/flower_variants
169170
if(isnull(flower_variants))

code/modules/client/preference_setup/occupation/occupation.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
skill_link = "<a href='byond://?src=\ref[src];set_skills=[title]'>View Skills</a>"
186186
skill_link = "<td>[skill_link]</td>"
187187

188-
if(!user.skillset?.skills_transferable)
188+
if(!user.skillset.skills_transferable)
189189
skill_link = ""
190190

191191
// Begin assembling the actual HTML.

code/modules/hydroponics/trays/tray_process.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
mutate((rand(100) < 15) ? 2 : 1)
6666
mutation_level = 0
6767

68-
if(pollen < 10)
68+
if(pollen < MAX_POLLEN_PER_FLOWER)
6969
pollen += seed?.produces_pollen * POLLEN_PRODUCTION_MULT
7070

7171
// Maintain tray nutrient and water levels.

mods/content/beekeeping/hives/hive_swarm.dm

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
var/swarm_agitation = 0
1919
/// Percentage value; if it drops to 0, the swarm will be destroyed.
2020
var/swarm_intensity = 1
21-
/// if more states are added to swarm.dmi, increase this
22-
var/const/MAX_SWARM_STATE = 6
2321
/// Cooldown timer for next tick.
2422
VAR_PRIVATE/next_work = 0
2523
/// Time that smoke will wear off.
@@ -46,8 +44,7 @@
4644
if(!istype(owner))
4745
PRINT_STACK_TRACE("Insect swarm created with invalid hive: '[owner]'")
4846
return INITIALIZE_HINT_QDEL
49-
color = insect_type.swarm_color
50-
icon = insect_type.swarm_icon
47+
update_transform()
5148
update_swarm()
5249
LAZYDISTINCTADD(owner.swarms, src)
5350
START_PROCESSING(SSobj, src)
@@ -61,9 +58,29 @@
6158
STOP_PROCESSING(SSobj, src)
6259
return ..()
6360

61+
// Resolves the current swarm amount to a coarser value used for icon state selection.
62+
/obj/effect/insect_swarm/proc/get_swarm_state()
63+
return ceil((swarm_intensity / insect_type.max_swarm_intensity) * insect_type.max_swarm_state)
64+
65+
/obj/effect/insect_swarm/on_update_icon()
66+
. = ..()
67+
color = insect_type.swarm_color
68+
icon = insect_type.swarm_icon
69+
icon_state = num2text(get_swarm_state())
70+
if(is_smoked())
71+
icon_state = "[icon_state]_smoked"
72+
73+
/obj/effect/insect_swarm/update_transform()
74+
. = ..()
75+
// Some icon variation via transform.
76+
if(prob(75))
77+
var/matrix/swarm_transform = transform || matrix()
78+
swarm_transform.Turn(pick(90, 180, 270))
79+
transform = swarm_transform
80+
6481
/obj/effect/insect_swarm/proc/update_swarm()
65-
icon_state = num2text(ceil((swarm_intensity / insect_type.max_swarm_intensity) * MAX_SWARM_STATE))
66-
if(icon_state == "1")
82+
update_icon()
83+
if(get_swarm_state() == 1)
6784
SetName(insect_type.name_singular)
6885
desc = insect_type.insect_desc
6986
gender = NEUTER
@@ -72,11 +89,6 @@
7289
desc = insect_type.swarm_desc
7390
gender = PLURAL
7491

75-
// Some icon variation via transform.
76-
if(prob(75))
77-
var/matrix/swarm_transform = matrix()
78-
swarm_transform.Turn(pick(90, 180, 270))
79-
8092
/obj/effect/insect_swarm/proc/is_agitated()
8193
return QDELETED(owner) || (swarm_agitation > 0 && !is_smoked())
8294

@@ -349,10 +361,10 @@
349361
else
350362
start_automove(owner.holder)
351363

352-
// TODO: update icon (twitching on ground?)
353-
// TODO: lower agitation
354364
/obj/effect/insect_swarm/proc/was_smoked(smoke_time = 10 SECONDS)
355365
smoked_until = max(smoked_until, world.time + smoke_time)
366+
swarm_agitation = round(swarm_agitation * 0.75)
367+
addtimer(CALLBACK(src, PROC_REF(update_icon), TRUE), smoke_time, (TIMER_UNIQUE|TIMER_OVERRIDE))
356368

357369
/obj/effect/insect_swarm/proc/is_smoked()
358370
return world.time < smoked_until

mods/content/beekeeping/hives/insect_species/_insects.dm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
var/swarm_type = /obj/effect/insect_swarm
2323
var/max_swarm_growth_intensity = 50
2424
var/max_swarm_intensity = 100
25+
var/max_swarm_state = 6
2526

2627
// Venom delivered by swarms whens stinging a victim.
2728
var/sting_reagent
@@ -72,6 +73,17 @@
7273
if(!istype(produce_material, /decl/material))
7374
. += "non-material product material type: '[produce_material]'"
7475

76+
if(!swarm_icon)
77+
. += "null swarm icon"
78+
else
79+
for(var/i = 0 to max_swarm_state)
80+
var/check_state = num2text(i)
81+
if(!check_state_in_icon(check_state, swarm_icon))
82+
. += "missing active icon_state '[check_state]'"
83+
check_state = "[check_state]_smoked"
84+
if(!check_state_in_icon(check_state, swarm_icon))
85+
. += "missing smoked icon_state '[check_state]'"
86+
7587
/decl/insect_species/proc/fill_hive_frame(obj/item/frame)
7688

7789
if(!istype(frame) || QDELETED(frame))

0 commit comments

Comments
 (0)