Skip to content

Commit

Permalink
fix light for shuttles
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcrystall committed Jul 11, 2024
1 parent f3ea9ed commit d1bf8f3
Show file tree
Hide file tree
Showing 17 changed files with 285 additions and 63 deletions.
7 changes: 3 additions & 4 deletions code/controllers/subsystem/sunlighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,14 @@ SUBSYSTEM_DEF(sunlighting)

var/list/datum/time_of_day/steps = list()

var/allow_updates = TRUE
var/next_day = FALSE
var/current_color = ""
var/weather_blend_ammount = 0.3

var/game_time_length = 24 HOURS
var/custom_time_offset = 0

/datum/controller/subsystem/sunlighting/stat_entry(msg)
msg = "W:[GLOB.sunlight_queue_work.len]|U:[GLOB.sunlight_queue_update.len]|C:[GLOB.sunlight_queue_corner.len]"
msg = "W:[length(GLOB.sunlight_queue_work)]|U:[length(GLOB.sunlight_queue_update)]|C:[length(GLOB.sunlight_queue_corner)]"
return ..()

/datum/controller/subsystem/sunlighting/Initialize(timeofday)
Expand All @@ -126,7 +124,8 @@ SUBSYSTEM_DEF(sunlighting)
custom_time_offset = new_value

/datum/controller/subsystem/sunlighting/proc/game_time_offseted()
return (REALTIMEOFDAY + custom_time_offset) % game_time_length
return 0 // Idk, maintainers not alowed it and I don't asked, so some time later I'll ask 200%, rn just dead end for daytime change
// return (REALTIMEOFDAY + custom_time_offset) % game_time_length

/datum/controller/subsystem/sunlighting/proc/create_steps()
for(var/path in typesof(/datum/time_of_day))
Expand Down
2 changes: 2 additions & 0 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
var/area/current_area = loc
if(current_area?.lighting_effect)
overlays += current_area.lighting_effect
else
GLOB.sunlight_queue_work |= src

if(opacity)
directional_opacity = ALL_CARDINALS
Expand Down
10 changes: 5 additions & 5 deletions code/game/turfs/walls/wall_icon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
return

if(damage)
var/current_dmg_overlay = round(damage / damage_cap * damage_overlays.len) + 1
if(current_dmg_overlay > damage_overlays.len)
current_dmg_overlay = damage_overlays.len
var/current_dmg_overlay = round(damage / damage_cap * length(damage_overlays)) + 1
if(current_dmg_overlay > length(damage_overlays))
current_dmg_overlay = length(damage_overlays)

damage_overlay = current_dmg_overlay
overlays += damage_overlays[damage_overlay]
Expand All @@ -42,9 +42,9 @@
#undef cur_increment

/turf/closed/wall/proc/generate_damage_overlays()
var/alpha_inc = 256 / damage_overlays.len
var/alpha_inc = 256 / length(damage_overlays)

for(var/i = 1; i <= damage_overlays.len; i++)
for(var/i = 1; i <= length(damage_overlays); i++)
var/image/img = image(icon = 'icons/turf/walls/walls.dmi', icon_state = "overlay_damage")
img.blend_mode = BLEND_MULTIPLY
img.appearance_flags = NO_CLIENT_COLOR
Expand Down
107 changes: 73 additions & 34 deletions code/modules/shuttle/docking.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
new_hidden_turfs = list()
for(var/i in 1 to length(old_turfs))
CHECK_TICK
var/turf/oldT = old_turfs[i]
if(old_turfs[oldT] & MOVE_TURF)
var/turf/old_turf = old_turfs[i]
if(old_turfs[old_turf] & MOVE_TURF)
new_hidden_turfs += new_turfs[i]
SSshuttle.update_hidden_docking_ports(null, new_hidden_turfs)
/***************************************************************************************************************/
Expand Down Expand Up @@ -110,49 +110,49 @@
/obj/docking_port/mobile/proc/preflight_check(list/old_turfs, list/new_turfs, list/areas_to_move, rotation)
for(var/i in 1 to length(old_turfs))
CHECK_TICK
var/turf/oldT = old_turfs[i]
var/turf/newT = new_turfs[i]
if(!newT)
var/turf/old_turf = old_turfs[i]
var/turf/new_turf = new_turfs[i]
if(!new_turf)
return DOCKING_NULL_DESTINATION
if(!oldT)
if(!old_turf)
return DOCKING_NULL_SOURCE

var/area/old_area = oldT.loc
var/area/old_area = old_turf.loc
var/move_mode = old_area.beforeShuttleMove(shuttle_areas) //areas

for(var/atom/movable/moving_atom as anything in oldT.contents)
for(var/atom/movable/moving_atom as anything in old_turf.contents)
CHECK_TICK
if(moving_atom.loc != oldT) //fix for multi-tile objects
if(moving_atom.loc != old_turf) //fix for multi-tile objects
continue
move_mode = moving_atom.beforeShuttleMove(newT, rotation, move_mode, src) //atoms
move_mode = moving_atom.beforeShuttleMove(new_turf, rotation, move_mode, src) //atoms

move_mode = oldT.fromShuttleMove(newT, move_mode) //turfs
move_mode = newT.toShuttleMove(oldT, move_mode, src) //turfs
move_mode = old_turf.fromShuttleMove(new_turf, move_mode) //turfs
move_mode = new_turf.toShuttleMove(old_turf, move_mode, src) //turfs

if(move_mode & MOVE_AREA)
areas_to_move[old_area] = TRUE

old_turfs[oldT] = move_mode
old_turfs[old_turf] = move_mode

/obj/docking_port/mobile/proc/takeoff(list/old_turfs, list/new_turfs, list/moved_atoms, rotation, movement_direction, old_dock, area/underlying_old_area)
for(var/i in 1 to length(old_turfs))
var/turf/oldT = old_turfs[i]
var/turf/newT = new_turfs[i]
var/move_mode = old_turfs[oldT]
var/turf/old_turf = old_turfs[i]
var/turf/new_turf = new_turfs[i]
var/move_mode = old_turfs[old_turf]
if(move_mode & MOVE_CONTENTS)
for(var/k in oldT)
for(var/k in old_turf)
var/atom/movable/moving_atom = k
if(moving_atom.loc != oldT) //fix for multi-tile objects
if(moving_atom.loc != old_turf) //fix for multi-tile objects
continue
moving_atom.onShuttleMove(newT, oldT, movement_force, movement_direction, old_dock, src) //atoms
moved_atoms[moving_atom] = oldT
if(moving_atom.onShuttleMove(new_turf, old_turf, movement_force, movement_direction, old_dock, src)) //atoms
moved_atoms[moving_atom] = old_turf

if(move_mode & MOVE_TURF)
oldT.onShuttleMove(newT, movement_force, movement_direction) //turfs
old_turf.onShuttleMove(new_turf, movement_force, movement_direction, src) //turfs

if(move_mode & MOVE_AREA)
var/area/shuttle_area = oldT.loc
shuttle_area.onShuttleMove(oldT, newT, underlying_old_area) //areas
var/area/shuttle_area = old_turf.loc
shuttle_area.onShuttleMove(old_turf, new_turf, underlying_old_area) //areas

/obj/docking_port/mobile/proc/cleanup_runway(obj/docking_port/stationary/new_dock, list/old_turfs, list/new_turfs, list/areas_to_move, list/moved_atoms, rotation, movement_direction, area/underlying_old_area)
underlying_old_area.afterShuttleMove()
Expand All @@ -170,18 +170,57 @@
for(var/i in 1 to length(old_turfs))
CHECK_TICK
if(!(old_turfs[old_turfs[i]] & MOVE_TURF))
GLOB.sunlight_queue_work |= old_turfs[i]
GLOB.sunlight_queue_work |= new_turfs[i]
continue
var/turf/oldT = old_turfs[i]
var/turf/newT = new_turfs[i]
newT.afterShuttleMove(oldT, rotation) //turfs

var/turf/old_turf = old_turfs[i]
var/turf/new_turf = new_turfs[i]
// var/turf/new_ceiling = get_step_multiz(new_turf, UP)
if(new_turf.outdoor_effect)
qdel(new_turf.outdoor_effect, TRUE)
if(old_turf.outdoor_effect)
qdel(old_turf.outdoor_effect, TRUE)
//silent fix
new_turf.pseudo_roof = custom_ceiling
/*
if(new_ceiling)
if(!new_ceiling.baseturfs || !(new_ceiling.turf_flags & TURF_WEATHER_PROOF))
new_ceiling.ChangeTurf(custom_ceiling)
else
if(length(new_ceiling.baseturfs) > 1)
new_ceiling.baseturfs = list(new_ceiling.baseturfs[1], custom_ceiling) + new_ceiling.baseturfs.Copy(2, length(new_ceiling.baseturfs))
else
new_ceiling.baseturfs = list(custom_ceiling) + new_ceiling.baseturfs
else
new_turf.pseudo_roof = custom_ceiling
*/
new_turf.afterShuttleMove(old_turf, rotation)
GLOB.sunlight_queue_work |= new_turf

//silent fix
var/obj/effect/mapping_helpers/sunlight/pseudo_roof_setter/presetted_pseudo = locate(/obj/effect/mapping_helpers/sunlight/pseudo_roof_setter) in old_turf
old_turf.pseudo_roof = presetted_pseudo ? presetted_pseudo.pseudo_roof : initial(old_turf.pseudo_roof)
/*
var/turf/old_ceiling = get_step_multiz(old_turf, UP)
if(!old_ceiling)
var/obj/effect/mapping_helpers/sunlight/pseudo_roof_setter/presetted_pseudo = locate(/obj/effect/mapping_helpers/sunlight/pseudo_roof_setter) in old_turf
old_turf.pseudo_roof = presetted_pseudo ? presetted_pseudo.pseudo_roof : initial(old_turf.pseudo_roof)
else if(istype(old_ceiling, custom_ceiling))
var/turf/open/floor/roof/old_shuttle_ceiling = old_ceiling
old_shuttle_ceiling.ScrapeAway()
else
old_ceiling.baseturfs -= custom_ceiling
*/
GLOB.sunlight_queue_work |= old_turf

for(var/i in 1 to length(moved_atoms))
CHECK_TICK
var/atom/movable/moved_object = moved_atoms[i]
if(QDELETED(moved_object))
continue
var/turf/oldT = moved_atoms[moved_object]
moved_object.afterShuttleMove(oldT, movement_force, dir, preferred_direction, movement_direction, rotation)//atoms
var/turf/old_turf = moved_atoms[moved_object]
moved_object.afterShuttleMove(old_turf, movement_force, dir, preferred_direction, movement_direction, rotation)//atoms

// lateShuttleMove (There had better be a really good reason for additional stages beyond this)

Expand All @@ -196,15 +235,15 @@
CHECK_TICK
if(!(old_turfs[old_turfs[i]] & MOVE_CONTENTS | MOVE_TURF))
continue
var/turf/oldT = old_turfs[i]
var/turf/newT = new_turfs[i]
newT.lateShuttleMove(oldT)
var/turf/old_turf = old_turfs[i]
var/turf/new_turf = new_turfs[i]
new_turf.lateShuttleMove(old_turf)
old_turf.get_sky_and_weather_states()

for(var/i in 1 to length(moved_atoms))
CHECK_TICK
var/atom/movable/moved_object = moved_atoms[i]
if(QDELETED(moved_object))
continue
var/turf/oldT = moved_atoms[moved_object]
moved_object.lateShuttleMove(oldT, movement_force, movement_direction)

var/turf/old_turf = moved_atoms[moved_object]
moved_object.lateShuttleMove(old_turf, movement_force, movement_direction)
2 changes: 2 additions & 0 deletions code/modules/shuttle/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@
var/can_move_docking_ports = FALSE //if this shuttle can move docking ports other than the one it is docked at
var/list/hidden_turfs = list()

var/custom_ceiling = /turf/open/floor/roof/ship_hull

var/crashing = FALSE

var/shuttle_flags = NONE
Expand Down
19 changes: 17 additions & 2 deletions maps/bigredv2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"map_path": "map_files/BigRed",
"map_file": "BigRed.dmm",
"webmap_url": "Solaris",
"weather_holder": "/datum/weather_ss_map_holder/big_red",
"weather": [
"weather_dust"
],
"survivor_types": [
"/datum/equipment_preset/survivor/scientist/solaris",
"/datum/equipment_preset/survivor/doctor/solaris",
Expand Down Expand Up @@ -45,5 +47,18 @@
"Hive Wars",
"Faction Clash",
"Infection"
]
],
"map_day_night_modificator": {
"Midnight": 1,
"Night": 0.083,
"Dawn": 0.16,
"Sunrise": 0.25,
"Sunrise-Morning": 0.29,
"Morning": 0.33,
"Daytime": 0.416,
"Evening": 0.66,
"Sunset": 0.7916,
"Dusk": 0.916
},
"custom_time_length": 2422075
}
15 changes: 14 additions & 1 deletion maps/corsat.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,18 @@
"Hive Wars",
"Faction Clash",
"Infection"
]
],
"map_day_night_modificator": {
"Midnight": 1,
"Night": 0.083,
"Dawn": 0.16,
"Sunrise": 0.25,
"Sunrise-Morning": 0.29,
"Morning": 0.33,
"Daytime": 0.416,
"Evening": 0.66,
"Sunset": 0.7916,
"Dusk": 0.916
},
"custom_time_length": 129609
}
19 changes: 18 additions & 1 deletion maps/desert_dam.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"map_path": "map_files/DesertDam",
"map_file": "Desert_Dam.dmm",
"webmap_url": "Trijent",
"weather": [
"weather_rain",
"weather_dust"
],
"survivor_types": [
"/datum/equipment_preset/survivor/doctor/trijent",
"/datum/equipment_preset/survivor/scientist/trijent",
Expand Down Expand Up @@ -45,5 +49,18 @@
"Hive Wars",
"Faction Clash",
"Infection"
]
],
"map_day_night_modificator": {
"Midnight": 1,
"Night": 0.083,
"Dawn": 0.16,
"Sunrise": 0.25,
"Sunrise-Morning": 0.29,
"Morning": 0.33,
"Daytime": 0.416,
"Evening": 0.66,
"Sunset": 0.7916,
"Dusk": 0.916
},
"custom_time_length": 1483564
}
15 changes: 14 additions & 1 deletion maps/fiorina_sciannex.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,18 @@
"Hive Wars",
"Faction Clash",
"Infection"
]
],
"map_day_night_modificator": {
"Midnight": 1,
"Night": 0.083,
"Dawn": 0.16,
"Sunrise": 0.25,
"Sunrise-Morning": 0.29,
"Morning": 0.33,
"Daytime": 0.416,
"Evening": 0.66,
"Sunset": 0.7916,
"Dusk": 0.916
},
"custom_time_length": 65520
}
18 changes: 17 additions & 1 deletion maps/ice_colony_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"environment_traits": {
"COLD": true
},
"weather": [
"weather_snow"
],
"survivor_types": [
"/datum/equipment_preset/survivor/corporate/shiva",
"/datum/equipment_preset/survivor/doctor/shiva",
Expand Down Expand Up @@ -42,5 +45,18 @@
"Hive Wars",
"Faction Clash",
"Infection"
]
],
"map_day_night_modificator": {
"Midnight": 1,
"Night": 0.083,
"Dawn": 0.16,
"Sunrise": 0.25,
"Sunrise-Morning": 0.29,
"Morning": 0.33,
"Daytime": 0.416,
"Evening": 0.66,
"Sunset": 0.7916,
"Dusk": 0.916
},
"custom_time_length": 788466
}
Loading

0 comments on commit d1bf8f3

Please sign in to comment.