Naval Warfare

We only have 2 admin commands, one of them is secret (though not hard to find), and is meant for screwing around with idiots who aren’t worthy of a ban, but you’d rather them not be there.

The one that we will tell you, is the Admin Mode command. Simply type “am” without the quotes in console to have restrictions lifted from you. We created this so admins wouldn’t be restricted from playing the gamemode like normal.

There is a chat command for every player called givemoney. Type “!givemoney <player name/partial> <amount>” It will take money from you and give it to the said player. If you’re in admin mode, it will not take away your money, and you can use this to give people money who need it.

Read above

Thanks because people last night didn’t understand the gamemode so I had to say you just gotta wait till you get enough.

What era of Naval Warfare? 1600s or more modern like 1920s?

What ever you can build with props

Is there a way I can make more plugs around the rig?

You can do anything if you know how to code :wink:

The setting is currently some monstrous combination of the 2030’s and 1920’s
Eventually I want to update the map and some models to make it more futuristic.

To anyone running this gamemode (or any others for that matter) make sure you have npc_tf2_ghost removed from your server, check gamemodes/base/entities/entities/npc_tf2_ghost.lua

thanks for this

THEY REVIVED NAVAL PLAY!?

link me up son! i been looking for the gamemode download everywhere!

check the dates

Damn. I guess im still looking for it then…

Sup Constable Wanker lad

Running this gamemod on a Ubuntu server.
Anyone know how to clean this up ?
Console is spammed ever .1 of a sec with this error


[ERROR] gamemodes/navalwarfare/entities/entities/harbor_oiltransfer/init.lua:74: attempt to index field 'plug' (a nil value)
  1. unknown - gamemodes/navalwarfare/entities/entities/harbor_oiltransfer/init.lua:74

lines 74 & 75


	if self.plug.Tank!= nil then
		local remainingStorage = self.plug.Tank.MaxOil - self.plug.Tank.Oil

whole script


AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

include( "shared.lua" )
function ENT:SpawnFunction( ply, tr )
	if ( !tr.Hit ) then return end
	local SpawnPos = Vector(9678,9666,1074)	
	local ent = ents.Create( "harbor_oiltransfer" )
	ent:SetPos( SpawnPos )
	ent:Spawn()
	ent:Activate()
	return ent
end

function ENT:Initialize()
	self:SetModel( "models/props_lab/tpplugholder_single.mdl" )
	self:PhysicsInit( SOLID_VPHYSICS )
	self:SetMoveType( MOVETYPE_VPHYSICS )
	self:SetSolid( SOLID_VPHYSICS )
	self:SetUseType( SIMPLE_USE )
	self:SetOverlayText("Oil Relay")
	self:SetPos(Vector(9677,9666,1074))
	self:SetAngles(Angle(0,-90,0))
	self.Linked = false
	self.Oil = 0
	self.Linked = false
	self.OldLinked = false
	self.MaxOil = 16
	self.ISTANK = true
	self.ConnectDistance = 20
	self.DisconnectDistance = 25
	self.GetAttachmentAngle = function(self) 
		return Angle(self:GetAngles().pitch,self:GetAngles().yaw,-self:GetAngles().roll)
	end
	self.connectionpoint = (self:GetForward()*6)+(self:GetUp()*10)-(self:GetRight()*13)
	self.connectionangle = self:GetForward():Angle()
	self:CreateOutPort()
	self.plug = self:CreatePlug(self.plugPort)
	self.plugPort:Spawn()
	--local constraint, rope = constraint.Elastic( self.plug, self.plugPort, 0, 0, self.plug:GetForward()*-11, 
		--Vector(00,0,20), 200, 200, "cable/cable2", 3, true)
	local constraint, rope = constraint.Rope( self.plug, self.plugPort, 0, 0, self.plug:GetForward()*-11, 
			Vector(00,0,20), 200, 200, 0, 3, "cable/cable2", false)
end
function ENT:OnRemove()
	self.plug:Remove()
	self.plugPort:Remove()
end
function ENT:CreateOutPort()
	self.plugPort = ents.Create("harbor_plugPort")
	self.plugPort:SetPos(Vector(9825,9610,49.5))
	self.plugPort:SetAngles(Angle(0,-78,0))
end
function ENT:CreatePlug(ent)
	local plug = ents.Create("harbor_oilpump")
	plug:SetPos(self.plugPort:GetPos()+self.plugPort:GetForward()*5)
	plug:SetAngles(Angle(0,-90,0))
	plug:Spawn()
	plug:Activate()
	local phys = plug:GetPhysicsObject()
	if phys:IsValid() then
		phys:EnableMotion(false)
	end
	plug.smoothyaw = 0
	plug.smoothpitch = 0
	ent.plug = plug	
	return plug
end
function ENT:Think()
	self.connectionangle = self:GetForward():Angle()
	self:SetNWVector("connectionpoint", self.connectionpoint)
	self:SetNWVector("connectionangle", self.connectionangle)
	-- if self.plug.Tank != nil then
	if self.plug.Tank!= nil then
		local remainingStorage = self.plug.Tank.MaxOil - self.plug.Tank.Oil
		if remainingStorage < self.Oil then
			self.plug:SendOil(remainingStorage)
			self.Oil = self.Oil - remainingStorage
		elseif remainingStorage >= self.Oil then
			self.plug:SendOil(self.Oil)
			self.Oil = 0
		end
	end
	if self.Linked!=self.OldLinked then
		self.OldLinked = self.Linked
		if self.Linked then
			self:SetNWBool("isconnected", true)
			self.plugPort:SetNWBool("isconnected", true)
		else
			self:SetNWBool("isconnected", false)
			self.plugPort:SetNWBool("isconnected", false)
		end
	end
end

Well, the error seems to be related to the code that creates the plugs.

The error doesn’t seem to start in that line, but it could start on Line 38 and then going to the function called there.

Although in that file I see nothing defining a plugPort thus making the entity invalid for use in the called function.

You could also check the “harbor_oilpump” entity code just in case something is off in there.

I’ve been having myself some issues with Linux Servers where lua sometimes either runs too fast or just fails to run certain functions out of nowhere.

I will look into fixing it. Look into Naval Play 2 as well, idk how long ill keep fixing stuff (at least for the near future though if i know it is broken).