mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 20:16:55 +01:00
Merge remote-tracking branch 'upstream/master' into changeling
This commit is contained in:
@@ -179,6 +179,11 @@ datum/ai_laws/tyrant //This probably shouldn't be a default lawset.
|
||||
|
||||
/datum/ai_laws/proc/clear_ion_laws()
|
||||
src.ion = list()
|
||||
|
||||
/datum/ai_laws/proc/clear_zeroth_law(var/law_borg = null)
|
||||
src.zeroth = null
|
||||
if(law_borg)
|
||||
src.zeroth_borg = null
|
||||
|
||||
/datum/ai_laws/proc/show_laws(var/who)
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@
|
||||
/obj/item/clothing/mask/facehugger) // NOT CLOTHING AT ALLLLL
|
||||
whitelist = list(/obj/item/clothing,/obj/item/weapon/storage/belt,/obj/item/weapon/storage/backpack,
|
||||
/obj/item/device/radio/headset,/obj/item/device/pda,/obj/item/weapon/card/id,/obj/item/weapon/tank,
|
||||
/obj/item/weapon/handcuffs, /obj/item/weapon/legcuffs)
|
||||
/obj/item/weapon/restraints/handcuffs, /obj/item/weapon/restraints/legcuffs)
|
||||
|
||||
/datum/cargoprofile/trash
|
||||
name = "Trash"
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
/datum/crafting_recipe/table/stunprod
|
||||
name = "Stunprod"
|
||||
result_path = /obj/item/weapon/melee/baton/cattleprod
|
||||
reqs = list(/obj/item/weapon/handcuffs/cable = 1,
|
||||
reqs = list(/obj/item/weapon/restraints/handcuffs/cable = 1,
|
||||
/obj/item/stack/rods = 1,
|
||||
/obj/item/weapon/wirecutters = 1,
|
||||
/obj/item/weapon/stock_parts/cell = 1)
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
teleatom.visible_message("\red <B>The [teleatom] bounces off of the portal!</B>")
|
||||
return 0
|
||||
|
||||
if(destination.z == 2) //centcomm z-level
|
||||
if((destination.z in config.admin_levels)) //centcomm z-level
|
||||
if(istype(teleatom, /obj/mecha))
|
||||
var/obj/mecha/MM = teleatom
|
||||
MM.occupant << "\red <B>The mech would not survive the jump to a location so far away!</B>"
|
||||
@@ -200,6 +200,6 @@
|
||||
return 0
|
||||
|
||||
|
||||
if(destination.z > 7) //Away mission z-levels
|
||||
if(!(destination.z in config.player_levels)) //Away mission z-levels
|
||||
return 0
|
||||
return 1
|
||||
+1
-1
@@ -1082,7 +1082,7 @@ datum/mind
|
||||
switch(href_list["common"])
|
||||
if("undress")
|
||||
for(var/obj/item/W in current)
|
||||
current.drop_from_inventory(W)
|
||||
current.unEquip(W, 1)
|
||||
if("takeuplink")
|
||||
take_uplink()
|
||||
memory = null//Remove any memory they may have had.
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
author = "Nanotrasen Editor"
|
||||
channel_name = "Tau Ceti Daily"
|
||||
can_be_redacted = 0
|
||||
message_type = "Story"
|
||||
|
||||
revolution_inciting_event
|
||||
|
||||
@@ -129,12 +130,6 @@ proc/check_for_newscaster_updates(type)
|
||||
|
||||
proc/announce_newscaster_news(datum/news_announcement/news)
|
||||
|
||||
var/datum/feed_message/newMsg = new /datum/feed_message
|
||||
newMsg.author = news.author
|
||||
newMsg.is_admin_message = !news.can_be_redacted
|
||||
|
||||
newMsg.body = news.message
|
||||
|
||||
var/datum/feed_channel/sendto
|
||||
for(var/datum/feed_channel/FC in news_network.network_channels)
|
||||
if(FC.channel_name == news.channel_name)
|
||||
@@ -148,6 +143,12 @@ proc/announce_newscaster_news(datum/news_announcement/news)
|
||||
sendto.locked = 1
|
||||
sendto.is_admin_channel = 1
|
||||
news_network.network_channels += sendto
|
||||
|
||||
var/datum/feed_message/newMsg = new /datum/feed_message
|
||||
newMsg.author = news.author ? news.author : sendto.author
|
||||
newMsg.is_admin_message = !news.can_be_redacted
|
||||
newMsg.body = news.message
|
||||
newMsg.message_type = news.message_type
|
||||
|
||||
sendto.messages += newMsg
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
|
||||
caster.reset_view(0)
|
||||
return 0
|
||||
|
||||
if(user.z == 2 && !centcom_cancast) //Certain spells are not allowed on the centcom zlevel
|
||||
if((user.z in config.admin_levels) && !centcom_cancast) //Certain spells are not allowed on the centcom zlevel
|
||||
return 0
|
||||
|
||||
if(!skipcharge)
|
||||
|
||||
@@ -35,12 +35,13 @@
|
||||
return
|
||||
|
||||
var/obj/item/clothing/mask/horsehead/magichead = new /obj/item/clothing/mask/horsehead
|
||||
magichead.canremove = 0 //curses!
|
||||
magichead.flags |= NODROP //curses!
|
||||
magichead.flags_inv = null //so you can still see their face
|
||||
magichead.voicechange = 1 //NEEEEIIGHH
|
||||
target.visible_message( "<span class='danger'>[target]'s face lights up in fire, and after the event a horse's head takes its place!</span>", \
|
||||
"<span class='danger'>Your face burns up, and shortly after the fire you realise you have the face of a horse!</span>")
|
||||
target.drop_from_inventory(target.wear_mask)
|
||||
if(!target.unEquip(target.wear_mask))
|
||||
del target.wear_mask
|
||||
target.equip_to_slot_if_possible(magichead, slot_wear_mask, 1, 1)
|
||||
|
||||
flick("e_flash", target.flash)
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
item_to_retrive = null
|
||||
break
|
||||
|
||||
M.u_equip(item_to_retrive)
|
||||
M.unEquip(item_to_retrive)
|
||||
|
||||
if(ishuman(M)) //Edge case housekeeping
|
||||
var/mob/living/carbon/human/C = M
|
||||
|
||||
+6
-51
@@ -16,7 +16,7 @@
|
||||
rate = -rate
|
||||
solar_next_update = world.time // init the timer
|
||||
angle = rand (0,360) // the station position to the sun is randomised at round start
|
||||
|
||||
|
||||
/hook/startup/proc/createSun()
|
||||
sun = new /datum/sun()
|
||||
return 1
|
||||
@@ -50,54 +50,9 @@
|
||||
dx = s/abs(s)
|
||||
dy = c / abs(s)
|
||||
|
||||
|
||||
for(var/obj/machinery/power/M in solars_list)
|
||||
|
||||
if(!M.powernet)
|
||||
solars_list.Remove(M)
|
||||
//now tell the solar control computers to update their status and linked devices
|
||||
for(var/obj/machinery/power/solar_control/SC in solars_list)
|
||||
if(!SC.powernet)
|
||||
solars_list.Remove(SC)
|
||||
continue
|
||||
|
||||
// Solar Tracker
|
||||
if(istype(M, /obj/machinery/power/tracker))
|
||||
var/obj/machinery/power/tracker/T = M
|
||||
T.set_angle(angle)
|
||||
|
||||
// Solar Control
|
||||
else if(istype(M, /obj/machinery/power/solar_control))
|
||||
var/obj/machinery/power/solar_control/C = M
|
||||
if(C.track == 1) //if manual tracking...
|
||||
C.tracker_update() //...update the position (not passing an angle, it is handled internally for manual tracking)
|
||||
|
||||
// Solar Panel
|
||||
else if(istype(M, /obj/machinery/power/solar))
|
||||
var/obj/machinery/power/solar/S = M
|
||||
if(S.control)
|
||||
occlusion(S)
|
||||
|
||||
|
||||
// for a solar panel, trace towards sun to see if we're in shadow
|
||||
/datum/sun/proc/occlusion(var/obj/machinery/power/solar/S)
|
||||
|
||||
var/ax = S.x // start at the solar panel
|
||||
var/ay = S.y
|
||||
var/turf/T = null
|
||||
|
||||
for(var/i = 1 to 20) // 20 steps is enough
|
||||
ax += dx // do step
|
||||
ay += dy
|
||||
|
||||
T = locate( round(ax,0.5),round(ay,0.5),S.z)
|
||||
|
||||
if(T.x == 1 || T.x==world.maxx || T.y==1 || T.y==world.maxy) // not obscured if we reach the edge
|
||||
break
|
||||
|
||||
if(T.density) // if we hit a solid turf, panel is obscured
|
||||
S.obscured = 1
|
||||
return
|
||||
|
||||
S.obscured = 0 // if hit the edge or stepped 20 times, not obscured
|
||||
S.update_solar_exposure()
|
||||
|
||||
|
||||
|
||||
|
||||
SC.update()
|
||||
|
||||
Executable → Regular
+1296
-1204
File diff suppressed because it is too large
Load Diff
@@ -1,179 +0,0 @@
|
||||
#define UPDATE_BUFFER 25 // 2.5 seconds
|
||||
|
||||
// CAMERA CHUNK
|
||||
//
|
||||
// A 16x16 grid of the map with a list of turfs that can be seen, are visible and are dimmed.
|
||||
// Allows the mob using this chunk to stream these chunks and know what it can and cannot see.
|
||||
|
||||
/datum/visibility_chunk
|
||||
var/obscured_image = 'icons/effects/cameravis.dmi'
|
||||
var/obscured_sub = "black"
|
||||
var/list/obscuredTurfs = list()
|
||||
var/list/visibleTurfs = list()
|
||||
var/list/obscured = list()
|
||||
var/list/viewpoints = list()
|
||||
var/list/turfs = list()
|
||||
var/list/seenby = list()
|
||||
var/visible = 0
|
||||
var/changed = 0
|
||||
var/updating = 0
|
||||
var/x = 0
|
||||
var/y = 0
|
||||
var/z = 0
|
||||
|
||||
/datum/visibility_chunk/proc/add(mob/new_mob)
|
||||
|
||||
// if this thing doesn't use one of these visibility systems, kick it out
|
||||
if (!new_mob.visibility_interface)
|
||||
return
|
||||
|
||||
// if the mob being added isn't a valid form of that mob, kick it out
|
||||
if (!new_mob.visibility_interface:canBeAddedToChunk(src))
|
||||
return
|
||||
|
||||
// add this chunk to the list of visible chunks
|
||||
new_mob.visibility_interface:addChunk(src)
|
||||
|
||||
visible++
|
||||
seenby += new_mob
|
||||
if(changed && !updating)
|
||||
update()
|
||||
|
||||
/datum/visibility_chunk/proc/remove(mob/new_mob)
|
||||
// if this thing doesn't use one of these visibility systems, kick it out
|
||||
if (!new_mob.visibility_interface)
|
||||
return
|
||||
|
||||
// if the mob being added isn't a valid form of that mob, kick it out
|
||||
if (!new_mob.visibility_interface:canBeAddedToChunk(src))
|
||||
return
|
||||
|
||||
// remove the chunk
|
||||
new_mob.visibility_interface:removeChunk(src)
|
||||
|
||||
// remove the mob from out lists
|
||||
seenby -= new_mob
|
||||
if(visible > 0)
|
||||
visible--
|
||||
|
||||
/datum/visibility_chunk/proc/visibilityChanged(turf/loc)
|
||||
if(!visibleTurfs[loc])
|
||||
return
|
||||
hasChanged()
|
||||
|
||||
/datum/visibility_chunk/proc/hasChanged(var/update_now = 0)
|
||||
if(visible || update_now)
|
||||
if(!updating)
|
||||
updating = 1
|
||||
spawn(UPDATE_BUFFER) // Batch large changes, such as many doors opening or closing at once
|
||||
update()
|
||||
updating = 0
|
||||
else
|
||||
changed = 1
|
||||
|
||||
|
||||
/*
|
||||
This function needs to be overwritten to return True if the viewpoint object is valid, and false if it is not.
|
||||
*/
|
||||
/datum/visibility_chunk/proc/validViewpoint(var/viewpoint)
|
||||
return FALSE
|
||||
|
||||
/*
|
||||
This function needs to be overwritten to return a list of visible turfs for that viewpoint
|
||||
*/
|
||||
/datum/visibility_chunk/proc/getVisibleTurfsForViewpoint(var/viewpoint)
|
||||
return list()
|
||||
|
||||
// returns a list of turfs which can be seen in by the chunks viewpoints
|
||||
/datum/visibility_chunk/proc/getVisibleTurfs()
|
||||
var/list/newVisibleTurfs = list()
|
||||
for(var/viewpoint in viewpoints)
|
||||
if (validViewpoint(viewpoint))
|
||||
for (var/turf/t in getVisibleTurfsForViewpoint(viewpoint))
|
||||
newVisibleTurfs[t]=t
|
||||
return newVisibleTurfs
|
||||
|
||||
/*
|
||||
This function needs to be overwritten to find nearby viewpoint objects to the chunk center.
|
||||
*/
|
||||
/datum/visibility_chunk/proc/findNearbyViewpoints()
|
||||
return FALSE
|
||||
|
||||
/*
|
||||
This function can be overwritten to change or randomize the obscuring images
|
||||
*/
|
||||
/datum/visibility_chunk/proc/setObscuredImage(var/turf/target_turf)
|
||||
if(!target_turf.obscured)
|
||||
target_turf.obscured = image(obscured_image, target_turf, obscured_sub, 15)
|
||||
|
||||
/datum/visibility_chunk/proc/update()
|
||||
|
||||
set background = 1
|
||||
|
||||
// get a list of all the turfs that our viewpoints can see
|
||||
var/list/newVisibleTurfs = getVisibleTurfs()
|
||||
|
||||
// Removes turf that isn't in turfs.
|
||||
newVisibleTurfs &= turfs
|
||||
|
||||
var/list/visAdded = newVisibleTurfs - visibleTurfs
|
||||
var/list/visRemoved = visibleTurfs - newVisibleTurfs
|
||||
|
||||
visibleTurfs = newVisibleTurfs
|
||||
obscuredTurfs = turfs - newVisibleTurfs
|
||||
|
||||
// update the visibility overlays
|
||||
for(var/turf in visAdded)
|
||||
var/turf/t = turf
|
||||
if(t.obscured)
|
||||
obscured -= t.obscured
|
||||
for(var/mob/current_mob in seenby)
|
||||
if (current_mob.visibility_interface)
|
||||
current_mob.visibility_interface:removeObscuredTurf(t)
|
||||
|
||||
for(var/turf in visRemoved)
|
||||
var/turf/t = turf
|
||||
if(obscuredTurfs[t])
|
||||
setObscuredImage(t)
|
||||
obscured += t.obscured
|
||||
for(var/mob/current_mob in seenby)
|
||||
if (current_mob.visibility_interface)
|
||||
current_mob.visibility_interface:addObscuredTurf(t)
|
||||
else
|
||||
seenby -= current_mob
|
||||
|
||||
|
||||
// Create a new chunk, since the chunks are made as they are needed.
|
||||
/datum/visibility_chunk/New(loc, x, y, z)
|
||||
|
||||
// 0xf = 15
|
||||
x &= ~0xf
|
||||
y &= ~0xf
|
||||
|
||||
src.x = x
|
||||
src.y = y
|
||||
src.z = z
|
||||
|
||||
for(var/turf/t in range(10, locate(x + 8, y + 8, z)))
|
||||
if(t.x >= x && t.y >= y && t.x < x + 16 && t.y < y + 16)
|
||||
turfs[t] = t
|
||||
|
||||
// locate all nearby viewpoints
|
||||
findNearbyViewpoints()
|
||||
|
||||
// get the turfs that are visible to those viewpoints
|
||||
visibleTurfs = getVisibleTurfs()
|
||||
|
||||
// Removes turf that isn't in turfs.
|
||||
visibleTurfs &= turfs
|
||||
|
||||
// create the list of turfs we can't see
|
||||
obscuredTurfs = turfs - visibleTurfs
|
||||
|
||||
// create the list of obscuring images to add to viewing clients
|
||||
for(var/turf in obscuredTurfs)
|
||||
var/turf/t = turf
|
||||
setObscuredImage(t)
|
||||
obscured += t.obscured
|
||||
|
||||
#undef UPDATE_BUFFER
|
||||
@@ -1,11 +0,0 @@
|
||||
var/datum/visibility_network/cameras/cameranet = new()
|
||||
var/datum/visibility_network/cult/cultNetwork = new()
|
||||
var/datum/visibility_network/list/visibility_networks = list("ALL_CAMERAS"=cameranet, "CULT" = cultNetwork)
|
||||
|
||||
|
||||
// used by turfs and objects to update all visibility networks
|
||||
/proc/updateVisibilityNetworks(atom/A, var/opacity_check = 1)
|
||||
var/datum/visibility_network/currentNetwork
|
||||
for (var/networkName in visibility_networks)
|
||||
currentNetwork = visibility_networks[networkName]
|
||||
currentNetwork.updateVisibility(A, opacity_check)
|
||||
@@ -1,94 +0,0 @@
|
||||
//UPDATE TRIGGERS, when the chunk (and the surrounding chunks) should update.
|
||||
|
||||
// TURFS
|
||||
|
||||
/turf
|
||||
var/image/obscured
|
||||
|
||||
/turf/proc/visibilityChanged()
|
||||
if(ticker)
|
||||
updateVisibilityNetworks(src)
|
||||
|
||||
/turf/simulated/Del()
|
||||
visibilityChanged()
|
||||
..()
|
||||
|
||||
/turf/simulated/New()
|
||||
..()
|
||||
visibilityChanged()
|
||||
|
||||
|
||||
|
||||
// STRUCTURES
|
||||
|
||||
/obj/structure/Del()
|
||||
if(ticker)
|
||||
updateVisibilityNetworks(src)
|
||||
..()
|
||||
|
||||
/obj/structure/New()
|
||||
..()
|
||||
if(ticker)
|
||||
updateVisibilityNetworks(src)
|
||||
|
||||
// EFFECTS
|
||||
|
||||
/obj/effect/Del()
|
||||
if(ticker)
|
||||
updateVisibilityNetworks(src)
|
||||
..()
|
||||
|
||||
/obj/effect/New()
|
||||
..()
|
||||
if(ticker)
|
||||
updateVisibilityNetworks(src)
|
||||
|
||||
|
||||
// DOORS
|
||||
|
||||
// Simply updates the visibility of the area when it opens/closes/destroyed.
|
||||
/obj/machinery/door/proc/update_nearby_tiles(need_rebuild)
|
||||
|
||||
if(!glass)
|
||||
updateVisibilityNetworks(src,0)
|
||||
|
||||
if(!air_master)
|
||||
return 0
|
||||
|
||||
for(var/turf/simulated/turf in locs)
|
||||
update_heat_protection(turf)
|
||||
air_master.mark_for_update(turf)
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
#define UPDATE_VISIBILITY_NETWORK_BUFFER 30
|
||||
|
||||
/mob
|
||||
var/datum/visibility_network/list/visibilityNetworks=list()
|
||||
var/updatingVisibilityNetworks=FALSE
|
||||
|
||||
/mob/Move(n,direct)
|
||||
var/oldLoc = src.loc
|
||||
//. = ..()
|
||||
if(..(n,direct))
|
||||
if(src.visibilityNetworks.len)
|
||||
if(!src.updatingVisibilityNetworks)
|
||||
src.updatingVisibilityNetworks = 1
|
||||
spawn(UPDATE_VISIBILITY_NETWORK_BUFFER)
|
||||
if(oldLoc != src.loc)
|
||||
for (var/datum/visibility_network/currentNetwork in src.visibilityNetworks)
|
||||
currentNetwork.updateMob(src)
|
||||
src.updatingVisibilityNetworks = 0
|
||||
return .
|
||||
|
||||
/mob/proc/addToVisibilityNetwork(var/datum/visibility_network/network)
|
||||
if(network)
|
||||
src.visibilityNetworks+=network
|
||||
|
||||
/mob/proc/removeFromVisibilityNetwork(var/datum/visibility_network/network)
|
||||
if(network)
|
||||
src.visibilityNetworks|=network
|
||||
|
||||
#undef UPDATE_VISIBILITY_NETWORK_BUFFER
|
||||
@@ -1,46 +0,0 @@
|
||||
/datum/visibility_interface
|
||||
var/chunk_type = null
|
||||
var/mob/controller = null
|
||||
var/list/visible_chunks = list()
|
||||
|
||||
|
||||
/datum/visibility_interface/New(var/mob/controller)
|
||||
src.controller = controller
|
||||
|
||||
|
||||
/datum/visibility_interface/proc/validMob()
|
||||
return getClient()
|
||||
|
||||
/datum/visibility_interface/proc/getClient()
|
||||
return controller.client
|
||||
|
||||
/datum/visibility_interface/proc/canBeAddedToChunk(var/datum/visibility_chunk/test_chunk)
|
||||
return istype(test_chunk,chunk_type)
|
||||
|
||||
|
||||
/datum/visibility_interface/proc/addChunk(var/datum/visibility_chunk/test_chunk)
|
||||
visible_chunks+=test_chunk
|
||||
var/client/currentClient = getClient()
|
||||
if(currentClient)
|
||||
currentClient.images += test_chunk.obscured
|
||||
|
||||
|
||||
/datum/visibility_interface/proc/removeChunk(var/datum/visibility_chunk/test_chunk)
|
||||
visible_chunks-=test_chunk
|
||||
var/client/currentClient = getClient()
|
||||
if(currentClient)
|
||||
currentClient.images -= test_chunk.obscured
|
||||
|
||||
|
||||
/datum/visibility_interface/proc/removeObscuredTurf(var/turf/target_turf)
|
||||
if(validMob())
|
||||
var/client/currentClient = getClient()
|
||||
if(currentClient)
|
||||
currentClient.images -= target_turf.obscured
|
||||
|
||||
|
||||
/datum/visibility_interface/proc/addObscuredTurf(var/turf/target_turf)
|
||||
if(validMob())
|
||||
var/client/currentClient = getClient()
|
||||
if(currentClient)
|
||||
currentClient.images -= target_turf.obscured
|
||||
@@ -1,144 +0,0 @@
|
||||
/datum/visibility_network
|
||||
var/list/viewpoints = list()
|
||||
|
||||
// the type of chunk used by this network
|
||||
var/datum/visibility_chunk/ChunkType = /datum/visibility_chunk
|
||||
|
||||
// The chunks of the map, mapping the areas that the viewpoints can see.
|
||||
var/list/chunks = list()
|
||||
|
||||
var/ready = 0
|
||||
|
||||
|
||||
// Creates a chunk key string from x,y,z coordinates
|
||||
/datum/visibility_network/proc/createChunkKey(x,y,z)
|
||||
x &= ~0xf
|
||||
y &= ~0xf
|
||||
return "[x],[y],[z]"
|
||||
|
||||
|
||||
// Checks if a chunk has been Generated in x, y, z.
|
||||
/datum/visibility_network/proc/chunkGenerated(x, y, z)
|
||||
return (chunks[createChunkKey(x, y, z)])
|
||||
|
||||
|
||||
// Returns the chunk in the x, y, z.
|
||||
// If there is no chunk, it creates a new chunk and returns that.
|
||||
/datum/visibility_network/proc/getChunk(x, y, z)
|
||||
var/key = createChunkKey(x, y, z)
|
||||
if(!chunks[key])
|
||||
chunks[key] = new ChunkType(null, x, y, z)
|
||||
return chunks[key]
|
||||
|
||||
|
||||
/datum/visibility_network/proc/visibility(var/mob/targetMob)
|
||||
|
||||
// if we've got not visibility interface on the mob, we canot do this
|
||||
if (!targetMob.visibility_interface)
|
||||
return
|
||||
|
||||
// 0xf = 15
|
||||
var/x1 = max(0, targetMob.x - 16) & ~0xf
|
||||
var/y1 = max(0, targetMob.y - 16) & ~0xf
|
||||
var/x2 = min(world.maxx, targetMob.x + 16) & ~0xf
|
||||
var/y2 = min(world.maxy, targetMob.y + 16) & ~0xf
|
||||
|
||||
var/list/visibleChunks = list()
|
||||
|
||||
for(var/x = x1; x <= x2; x += 16)
|
||||
for(var/y = y1; y <= y2; y += 16)
|
||||
visibleChunks += getChunk(x, y, targetMob.z)
|
||||
|
||||
var/list/remove = targetMob.visibility_interface:visible_chunks - visibleChunks
|
||||
var/list/add = visibleChunks - targetMob.visibility_interface:visible_chunks
|
||||
|
||||
for(var/datum/visibility_chunk/chunk in remove)
|
||||
chunk.remove(targetMob)
|
||||
|
||||
for(var/datum/visibility_chunk/chunk in add)
|
||||
chunk.add(targetMob)
|
||||
|
||||
|
||||
// Updates the chunks that the turf is located in. Use this when obstacles are destroyed or when doors open.
|
||||
/datum/visibility_network/proc/updateVisibility(atom/A, var/opacity_check = 1)
|
||||
if(!ticker || (opacity_check && !A.opacity))
|
||||
return
|
||||
majorChunkChange(A, 2)
|
||||
|
||||
|
||||
/datum/visibility_network/proc/updateChunk(x, y, z)
|
||||
if(!chunkGenerated(x, y, z))
|
||||
return
|
||||
var/datum/visibility_chunk/chunk = getChunk(x, y, z)
|
||||
chunk.hasChanged()
|
||||
|
||||
|
||||
/datum/visibility_network/proc/validViewpoint(var/viewpoint)
|
||||
return FALSE
|
||||
|
||||
|
||||
/datum/visibility_network/proc/addViewpoint(var/viewpoint)
|
||||
if(validViewpoint(viewpoint))
|
||||
majorChunkChange(viewpoint, 1)
|
||||
|
||||
|
||||
/datum/visibility_network/proc/removeViewpoint(var/viewpoint)
|
||||
if(validViewpoint(viewpoint))
|
||||
majorChunkChange(viewpoint, 0)
|
||||
|
||||
/datum/visibility_network/proc/getViewpointFromMob(var/mob/currentMob)
|
||||
return FALSE
|
||||
|
||||
/datum/visibility_network/proc/updateMob(var/mob/currentMob)
|
||||
var/viewpoint = getViewpointFromMob(currentMob)
|
||||
if(viewpoint)
|
||||
updateViewpoint(viewpoint)
|
||||
|
||||
|
||||
/datum/visibility_network/proc/updateViewpoint(var/viewpoint)
|
||||
if(validViewpoint(viewpoint))
|
||||
majorChunkChange(viewpoint, 1)
|
||||
|
||||
|
||||
// Never access this proc directly!!!!
|
||||
// This will update the chunk and all the surrounding chunks.
|
||||
// It will also add the atom to the cameras list if you set the choice to 1.
|
||||
// Setting the choice to 0 will remove the viewpoint from the chunks.
|
||||
// If you want to update the chunks around an object, without adding/removing a viewpoint, use choice 2.
|
||||
/datum/visibility_network/proc/majorChunkChange(atom/c, var/choice)
|
||||
// 0xf = 15
|
||||
if(!c)
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(c)
|
||||
if(T)
|
||||
var/x1 = max(0, T.x - 8) & ~0xf
|
||||
var/y1 = max(0, T.y - 8) & ~0xf
|
||||
var/x2 = min(world.maxx, T.x + 8) & ~0xf
|
||||
var/y2 = min(world.maxy, T.y + 8) & ~0xf
|
||||
|
||||
for(var/x = x1; x <= x2; x += 16)
|
||||
for(var/y = y1; y <= y2; y += 16)
|
||||
if(chunkGenerated(x, y, T.z))
|
||||
var/datum/visibility_chunk/chunk = getChunk(x, y, T.z)
|
||||
if(choice == 0)
|
||||
// Remove the viewpoint.
|
||||
chunk.viewpoints -= c
|
||||
else if(choice == 1)
|
||||
// You can't have the same viewpoint in the list twice.
|
||||
chunk.viewpoints |= c
|
||||
chunk.hasChanged()
|
||||
|
||||
// checks if the network can see a particular atom
|
||||
/datum/visibility_network/proc/checkCanSee(var/atom/target)
|
||||
var/turf/position = get_turf(target)
|
||||
return checkTurfVis(position)
|
||||
|
||||
/datum/visibility_network/proc/checkTurfVis(var/turf/position)
|
||||
var/datum/visibility_chunk/chunk = getChunk(position.x, position.y, position.z)
|
||||
if(chunk)
|
||||
if(chunk.changed)
|
||||
chunk.hasChanged(1) // Update now, no matter if it's visible or not.
|
||||
if(chunk.visibleTurfs[position])
|
||||
return 1
|
||||
return 0
|
||||
@@ -1,3 +1,5 @@
|
||||
#define CAT_HIDDEN 2 // Also in code/game/machinery/vending.dm
|
||||
|
||||
/datum/wires/vending
|
||||
holder_type = /obj/machinery/vending
|
||||
wire_count = 4
|
||||
@@ -17,17 +19,12 @@ var/const/VENDING_WIRE_IDSCAN = 8
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/vending/Interact(var/mob/living/user)
|
||||
if(CanUse(user))
|
||||
var/obj/machinery/vending/V = holder
|
||||
V.attack_hand(user)
|
||||
|
||||
/datum/wires/vending/GetInteractWindow()
|
||||
var/obj/machinery/vending/V = holder
|
||||
. += ..()
|
||||
. += "<BR>The orange light is [V.seconds_electrified ? "on" : "off"].<BR>"
|
||||
. += "The red light is [V.shoot_inventory ? "off" : "blinking"].<BR>"
|
||||
. += "The green light is [V.extended_inventory ? "on" : "off"].<BR>"
|
||||
. += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"].<BR>"
|
||||
. += "A [V.scan_id ? "purple" : "yellow"] light is on.<BR>"
|
||||
|
||||
/datum/wires/vending/UpdatePulsed(var/index)
|
||||
@@ -36,7 +33,7 @@ var/const/VENDING_WIRE_IDSCAN = 8
|
||||
if(VENDING_WIRE_THROW)
|
||||
V.shoot_inventory = !V.shoot_inventory
|
||||
if(VENDING_WIRE_CONTRABAND)
|
||||
V.extended_inventory = !V.extended_inventory
|
||||
V.categories ^= CAT_HIDDEN
|
||||
if(VENDING_WIRE_ELECTRIFY)
|
||||
V.seconds_electrified = 30
|
||||
if(VENDING_WIRE_IDSCAN)
|
||||
@@ -48,7 +45,7 @@ var/const/VENDING_WIRE_IDSCAN = 8
|
||||
if(VENDING_WIRE_THROW)
|
||||
V.shoot_inventory = !mended
|
||||
if(VENDING_WIRE_CONTRABAND)
|
||||
V.extended_inventory = 0
|
||||
V.categories &= ~CAT_HIDDEN
|
||||
if(VENDING_WIRE_ELECTRIFY)
|
||||
if(mended)
|
||||
V.seconds_electrified = 0
|
||||
|
||||
@@ -72,8 +72,11 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown",
|
||||
html = GetInteractWindow()
|
||||
if(html)
|
||||
user.set_machine(holder)
|
||||
//user << browse(html, "window=wires;size=[window_x]x[window_y]")
|
||||
//onclose(user, "wires")
|
||||
else
|
||||
user.unset_machine()
|
||||
// No content means no window.
|
||||
user << browse(null, "window=wires")
|
||||
return
|
||||
var/datum/browser/popup = new(user, "wires", holder.name, window_x, window_y)
|
||||
popup.set_content(html)
|
||||
popup.set_title_image(user.browse_rsc_icon(holder.icon, holder.icon_state))
|
||||
|
||||
Reference in New Issue
Block a user